/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('alikafka', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model ChangeResourceGroupRequest {
  newResourceGroupId?: string(name='NewResourceGroupId', description='The ID of the resource group to which you want to transfer the cloud resource.

>  You can use resource groups to manage resources owned by your Alibaba Cloud account. Resource groups simplify the resource and permission management of your Alibaba Cloud account. For more information, see [What is resource management?](https://help.aliyun.com/document_detail/94475.html)

This parameter is required.', example='rg-ac***********7q'),
  regionId?: string(name='RegionId', description='The region ID of the resource.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: string(name='ResourceId', description='The ID of the resource to which you want to attach a tag. Only the ID of a Message Queue for Apache Kafka instance is supported.

For example, if the ID of the instance is alikafka_post-cn-v0h1fgs2xxxx, the resource ID is alikafka_post-cn-v0h1fgs2xxxx.

This parameter is required.', example='alikafka_post-cn-v0h1fgs2****'),
}

model ChangeResourceGroupResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success'),
  newResourceGroupId?: string(name='NewResourceGroupId', description='The ID of the new resource group. You can view the available resource groups in the Resource Management console.', example='rg-ac***********7q'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='C5CA600C-7D5A-45B5-B6DB-44FAC2C****'),
  success?: long(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model ChangeResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ChangeResourceGroupResponseBody(name='body'),
}

/**
 * @summary Changes the resource group of an ApsaraMQ for Kafka instance.
 *
 * @param request ChangeResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ChangeResourceGroupResponse
 */
async function changeResourceGroupWithOptions(request: ChangeResourceGroupRequest, runtime: Util.RuntimeOptions): ChangeResourceGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.newResourceGroupId)) {
    query['NewResourceGroupId'] = request.newResourceGroupId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ChangeResourceGroup',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the resource group of an ApsaraMQ for Kafka instance.
 *
 * @param request ChangeResourceGroupRequest
 * @return ChangeResourceGroupResponse
 */
async function changeResourceGroup(request: ChangeResourceGroupRequest): ChangeResourceGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return changeResourceGroupWithOptions(request, runtime);
}

model ConvertPostPayOrderRequest {
  duration?: int32(name='Duration', description='The subscription duration. Unit: months. Valid values:

*   **1~12**
*   **24**
*   **36**', example='1'),
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_post-cn-v0h1fgs2****'),
  paidType?: int32(name='PaidType'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
}

model ConvertPostPayOrderResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The error message returned.', example='operation success.'),
  orderId?: string(name='OrderId', description='The ID of the order.', example='20497346575****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='06084011-E093-46F3-A51F-4B19A8AD****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model ConvertPostPayOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ConvertPostPayOrderResponseBody(name='body'),
}

/**
 * @summary Changes the billing method of a Message Queue for Apache Kafka instance from pay-as-you-go to subscription.
 *
 * @param request ConvertPostPayOrderRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ConvertPostPayOrderResponse
 */
async function convertPostPayOrderWithOptions(request: ConvertPostPayOrderRequest, runtime: Util.RuntimeOptions): ConvertPostPayOrderResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.duration)) {
    query['Duration'] = request.duration;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.paidType)) {
    query['PaidType'] = request.paidType;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ConvertPostPayOrder',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the billing method of a Message Queue for Apache Kafka instance from pay-as-you-go to subscription.
 *
 * @param request ConvertPostPayOrderRequest
 * @return ConvertPostPayOrderResponse
 */
async function convertPostPayOrder(request: ConvertPostPayOrderRequest): ConvertPostPayOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  return convertPostPayOrderWithOptions(request, runtime);
}

model CreateAclRequest {
  aclOperationType?: string(name='AclOperationType', description='The type of the operation allowed by the access control list (ACL). Valid values:

*   **Write**
*   **Read**
*   **Describe**: reads of transactional IDs.
*   **IdempotentWrite**: idempotent data writes to clusters.
*   **IDEMPOTENT_WRITE**: idempotent data writes to clusters. This value is available only for serverless ApsaraMQ for Kafka instances.
*   **DESCRIBE_CONFIGS**: configuration query. This value is available only for serverless ApsaraMQ for Kafka instances.

This parameter is required.', example='Read'),
  aclOperationTypes?: string(name='AclOperationTypes', description='The types of operations allowed by the ACL. Separate multiple operation types with commas (,).

Valid values:

*   **Write**
*   **Read**
*   **Describe**: reads of transactional IDs.
*   **IdempotentWrite**: idempotent data writes to clusters.
*   **IDEMPOTENT_WRITE**: idempotent data writes to clusters. This value is available only for serverless ApsaraMQ for Kafka instances.
*   **DESCRIBE_CONFIGS**: configuration query. This value is available only for serverless ApsaraMQ for Kafka instances.

>  This parameter is available only for serverless ApsaraMQ for Kafka instances.', example='Write,Read'),
  aclPermissionType?: string(name='AclPermissionType', description='The authorization method. Valid values:

*   **DENY**
*   **ALLOW**

>  This parameter is available only for serverless ApsaraMQ for Kafka instances.', example='DENY'),
  aclResourceName?: string(name='AclResourceName', description='The resource name.

*   The value can be a topic name, a group ID, a cluster name, or a transaction ID.
*   You can use an asterisk (\\\\*) to specify the names of all resources of the specified type.

> You can use an asterisk (\\\\*) to query the resources on which permissions are granted only after you grant the user the required permissions on all resources.

This parameter is required.', example='X****'),
  aclResourcePatternType?: string(name='AclResourcePatternType', description='The matching mode. Valid values:

*   **LITERAL**: exact match
*   **PREFIXED**: prefix match

This parameter is required.', example='LITERAL'),
  aclResourceType?: string(name='AclResourceType', description='The resource type. Valid values:

*   **Topic**
*   **Group**
*   **Cluster**
*   **TransactionalId**: transactional ID

This parameter is required.', example='Group'),
  host?: string(name='Host', description='The IP address of the source.

> 

*   You can specify a specific IP address or use the asterisk (\\\\*) wildcard character to specify all IP addresses. CIDR blocks are not supported.

*   This parameter is available only for serverless ApsaraMQ for Kafka instances.', example='*'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_pre-cn-v0h1cng0****'),
  regionId?: string(name='RegionId', description='The region ID.

This parameter is required.', example='cn-hangzhou'),
  username?: string(name='Username', description='The username.

*   You can use an asterisk (\\\\*) to specify all usernames.

> You can use an asterisk (\\\\*) to query the authorized users only after you grant the required permissions to all users.

This parameter is required.', example='test***'),
}

model CreateAclResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The message returned.', example='operation success'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='56729737-C428-4E1B-AC68-7A8C2D5****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model CreateAclResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateAclResponseBody(name='body'),
}

/**
 * @summary Creates an access control list (ACL).
 *
 * @param request CreateAclRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateAclResponse
 */
async function createAclWithOptions(request: CreateAclRequest, runtime: Util.RuntimeOptions): CreateAclResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.aclOperationType)) {
    query['AclOperationType'] = request.aclOperationType;
  }
  if (!Util.isUnset(request.aclOperationTypes)) {
    query['AclOperationTypes'] = request.aclOperationTypes;
  }
  if (!Util.isUnset(request.aclPermissionType)) {
    query['AclPermissionType'] = request.aclPermissionType;
  }
  if (!Util.isUnset(request.aclResourceName)) {
    query['AclResourceName'] = request.aclResourceName;
  }
  if (!Util.isUnset(request.aclResourcePatternType)) {
    query['AclResourcePatternType'] = request.aclResourcePatternType;
  }
  if (!Util.isUnset(request.aclResourceType)) {
    query['AclResourceType'] = request.aclResourceType;
  }
  if (!Util.isUnset(request.host)) {
    query['Host'] = request.host;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.username)) {
    query['Username'] = request.username;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateAcl',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates an access control list (ACL).
 *
 * @param request CreateAclRequest
 * @return CreateAclResponse
 */
async function createAcl(request: CreateAclRequest): CreateAclResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAclWithOptions(request, runtime);
}

model CreateConsumerGroupRequest {
  consumerId?: string(name='ConsumerId', description='The name of the consumer group.

*   The value can contain only letters, digits, hyphens (-), and underscores (_), and the value must contain at least one letter or digit.
*   The value must be 3 to 128 characters in length. If the value that you specify contains more than 128 characters, the system automatically truncates the value to 128 characters.
*   After a consumer group is created, you cannot change the name of the consumer group.

This parameter is required.', example='test'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_post-cn-0pp1l9z8****'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  remark?: string(name='Remark', description='The description of the consumer group.', example='test'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key.

*   You must specify this parameter.
*   The tag key can be up to 128 characters in length and cannot start with acs: or aliyun. It cannot contain `http://` or `https://`.

This parameter is required.', example='FinanceDept'),
      value?: string(name='Value', description='The tag value.

*   You can leave this parameter empty.
*   The tag value can be up to 128 characters in length and cannot start with acs: or aliyun. It cannot contain `http://` or `https://`.', example='FinanceJoshua'),
    }
  ](name='Tag', description='The tags.'),
}

model CreateConsumerGroupResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The message returned.', example='operation success'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='E57A8862-DF68-4055-8E55-B80CB4****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model CreateConsumerGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateConsumerGroupResponseBody(name='body'),
}

/**
 * @summary Creates a consumer group.
 *
 * @param request CreateConsumerGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateConsumerGroupResponse
 */
async function createConsumerGroupWithOptions(request: CreateConsumerGroupRequest, runtime: Util.RuntimeOptions): CreateConsumerGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.consumerId)) {
    query['ConsumerId'] = request.consumerId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateConsumerGroup',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a consumer group.
 *
 * @param request CreateConsumerGroupRequest
 * @return CreateConsumerGroupResponse
 */
async function createConsumerGroup(request: CreateConsumerGroupRequest): CreateConsumerGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return createConsumerGroupWithOptions(request, runtime);
}

model CreatePostPayInstanceRequest {
  deployType?: int32(name='DeployType', description='This parameter is required.', example='4'),
  diskSize?: int32(name='DiskSize', example='1500'),
  diskType?: string(name='DiskType', example='0'),
  eipMax?: int32(name='EipMax', example='3'),
  ioMaxSpec?: string(name='IoMaxSpec', example='alikafka.hw.2xlarge'),
  paidType?: int32(name='PaidType', example='0'),
  partitionNum?: int32(name='PartitionNum', example='100'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-ac***********7q'),
  serverlessConfig?: {
    reservedPublishCapacity?: long(name='ReservedPublishCapacity', example='60'),
    reservedSubscribeCapacity?: long(name='ReservedSubscribeCapacity', example='50'),
  }(name='ServerlessConfig'),
  specType?: string(name='SpecType', example='professional'),
  tag?: [ 
    {
      key?: string(name='Key', description='This parameter is required.', example='FinanceDept'),
      value?: string(name='Value', example='test'),
    }
  ](name='Tag'),
}

model CreatePostPayInstanceShrinkRequest {
  deployType?: int32(name='DeployType', description='This parameter is required.', example='4'),
  diskSize?: int32(name='DiskSize', example='1500'),
  diskType?: string(name='DiskType', example='0'),
  eipMax?: int32(name='EipMax', example='3'),
  ioMaxSpec?: string(name='IoMaxSpec', example='alikafka.hw.2xlarge'),
  paidType?: int32(name='PaidType', example='0'),
  partitionNum?: int32(name='PartitionNum', example='100'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-ac***********7q'),
  serverlessConfigShrink?: string(name='ServerlessConfig'),
  specType?: string(name='SpecType', example='professional'),
  tag?: [ 
    {
      key?: string(name='Key', description='This parameter is required.', example='FinanceDept'),
      value?: string(name='Value', example='test'),
    }
  ](name='Tag'),
}

model CreatePostPayInstanceResponseBody = {
  code?: int32(name='Code', example='200'),
  data?: {
    instanceId?: string(name='InstanceId', example='alikafka_pre-cn-pe333xxxxxx'),
    orderId?: long(name='OrderId', example='236972661580636'),
  }(name='Data'),
  message?: string(name='Message', example='operation success.'),
  requestId?: string(name='RequestId', example='ABA4A7FD-E10F-45C7-9774-A5236015A***'),
  success?: boolean(name='Success', example='true'),
}

model CreatePostPayInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreatePostPayInstanceResponseBody(name='body'),
}

/**
 * @summary 创建后付费实例。
 *
 * @param tmpReq CreatePostPayInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreatePostPayInstanceResponse
 */
async function createPostPayInstanceWithOptions(tmpReq: CreatePostPayInstanceRequest, runtime: Util.RuntimeOptions): CreatePostPayInstanceResponse {
  Util.validateModel(tmpReq);
  var request = new CreatePostPayInstanceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.serverlessConfig)) {
    request.serverlessConfigShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.serverlessConfig, 'ServerlessConfig', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.deployType)) {
    query['DeployType'] = request.deployType;
  }
  if (!Util.isUnset(request.diskSize)) {
    query['DiskSize'] = request.diskSize;
  }
  if (!Util.isUnset(request.diskType)) {
    query['DiskType'] = request.diskType;
  }
  if (!Util.isUnset(request.eipMax)) {
    query['EipMax'] = request.eipMax;
  }
  if (!Util.isUnset(request.ioMaxSpec)) {
    query['IoMaxSpec'] = request.ioMaxSpec;
  }
  if (!Util.isUnset(request.paidType)) {
    query['PaidType'] = request.paidType;
  }
  if (!Util.isUnset(request.partitionNum)) {
    query['PartitionNum'] = request.partitionNum;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.serverlessConfigShrink)) {
    query['ServerlessConfig'] = request.serverlessConfigShrink;
  }
  if (!Util.isUnset(request.specType)) {
    query['SpecType'] = request.specType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreatePostPayInstance',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建后付费实例。
 *
 * @param request CreatePostPayInstanceRequest
 * @return CreatePostPayInstanceResponse
 */
async function createPostPayInstance(request: CreatePostPayInstanceRequest): CreatePostPayInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createPostPayInstanceWithOptions(request, runtime);
}

model CreatePostPayOrderRequest {
  deployType?: int32(name='DeployType', description='The deployment mode of the instance. Valid values:

*   **4**: deploys the instance that allows access from the Internet and a VPC.
*   **5**: deploys the instance that allows access only from a VPC.

This parameter is required.', example='5'),
  diskSize?: int32(name='DiskSize', description='The disk size.

For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='500'),
  diskType?: string(name='DiskType', description='The disk type of the instance. Valid values:

*   **0**: ultra disk
*   **1**: standard SSD

>  If you create a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='0'),
  eipMax?: int32(name='EipMax', description='The Internet traffic.

*   If you set **DeployType** to **4**, you must configure this parameter.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='0'),
  ioMax?: int32(name='IoMax', description='The maximum traffic in the instance. We recommend that you do not configure this parameter.

*   You must configure at least one of IoMax and IoMaxSpec. If you configure both parameters, the value of IoMaxSpec takes effect. We recommend that you configure only IoMaxSpec.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='20'),
  ioMaxSpec?: string(name='IoMaxSpec', description='The traffic specification of the instance. We recommend that you configure this parameter.

*   You must configure at least one of IoMax and IoMaxSpec. If you configure both parameters, the value of IoMaxSpec takes effect. We recommend that you configure only IoMaxSpec.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='alikafka.hw.2xlarge'),
  paidType?: int32(name='PaidType', description='The billing method of the instance. Valid values:

*   1: pay-as-you-go (reserved capacity).
*   3: pay-as-you-go (reserved capacity) + pay-as-you-go (on-demand capacity)', example='1'),
  partitionNum?: int32(name='PartitionNum', description='The number of partitions. We recommend that you configure this parameter.

*   You must configure one of PartitionNum and TopicQuota. We recommend that you configure only ParittionNum.
*   If you configure PartitionNum and TopicQuota at the same time, the system verifies whether the price of the partitions equals the price of the topics based on the previous topic-based selling mode. If the price of the partitions does not equal the price of the topics, an error is returned. If the price of the partitions equals the price of the topics, the instance is purchased based on the partition number.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='50'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.

If this parameter is left empty, the default resource group is used. You can view the resource group ID on the Resource Group page in the Resource Management console.', example='rg-ac***********7q'),
  serverlessConfig?: {
    reservedPublishCapacity?: long(name='ReservedPublishCapacity', description='The reserved capacity for publishing messages. You can specify only an integer for this parameter. Minimum value: 60.

>  The actual maximum reserved capacity for publishing messages varies based on available resources in the region. The actual range displayed on the buy page shall prevail.', example='60'),
    reservedSubscribeCapacity?: long(name='ReservedSubscribeCapacity', description='The reserved capacity for subscribing to messages. You can specify only an integer for this parameter. Minimum value: 20.

>  The actual maximum reserved capacity for subscribing to messages varies based on available resources in the region. The actual range displayed on the buy page shall prevail.', example='50'),
  }(name='ServerlessConfig', description='The parameters configured for the serverless ApsaraMQ for Kafka instance. These parameters are required only when you create a serverless instance.'),
  specType?: string(name='SpecType', description='The instance edition.

Valid values if you set PaidType to 1:

*   normal: Standard Edition (High Write)
*   professional: Professional Edition (High Write)
*   professionalForHighRead: Professional Edition (High Read)

Valid values if you set PaidType to 3:

*   normal: Serverless Standard Edition

For more information about the instance editions, see [Billing](https://help.aliyun.com/document_detail/84737.html).', example='normal'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N.

*   Valid values of N: 1 to 20.
*   If this parameter is left empty, the keys of all tags are matched.
*   The tag key must be up to 128 characters in length. It cannot start with acs: or aliyun or contain [http:// or https://.](http://https://。)

This parameter is required.', example='FinanceDept'),
      value?: string(name='Value', description='The value of tag N.

*   Valid values of N: 1 to 20.
*   If you do not specify a tag key, you cannot specify a tag value. If this parameter is not configured, all tag values are matched.
*   The tag value must be 1 to 128 characters in length. It cannot start with acs: or aliyun or contain [http:// or https://.](http://https://。)', example='FinanceJoshua'),
    }
  ](name='Tag', description='The tags.'),
  topicQuota?: int32(name='TopicQuota', description='The number of topics. We recommend that you do not configure this parameter.

*   You must configure one of PartitionNum and TopicQuota. We recommend that you configure only ParittionNum.
*   If you configure PartitionNum and TopicQuota at the same time, the system verifies whether the price of the partitions equals the price of the topics based on the previous topic-based selling mode. If the price of the partitions does not equal the price of the topics, an error is returned. If the price of the partitions equals the price of the topics, the instance is purchased based on the partition number.
*   The default value of TopicQuota varies based on the value of IoMaxSpec. If the number of topics that you consume exceeds the default value, you are charged additional fees.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='50'),
}

model CreatePostPayOrderShrinkRequest {
  deployType?: int32(name='DeployType', description='The deployment mode of the instance. Valid values:

*   **4**: deploys the instance that allows access from the Internet and a VPC.
*   **5**: deploys the instance that allows access only from a VPC.

This parameter is required.', example='5'),
  diskSize?: int32(name='DiskSize', description='The disk size.

For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='500'),
  diskType?: string(name='DiskType', description='The disk type of the instance. Valid values:

*   **0**: ultra disk
*   **1**: standard SSD

>  If you create a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='0'),
  eipMax?: int32(name='EipMax', description='The Internet traffic.

*   If you set **DeployType** to **4**, you must configure this parameter.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='0'),
  ioMax?: int32(name='IoMax', description='The maximum traffic in the instance. We recommend that you do not configure this parameter.

*   You must configure at least one of IoMax and IoMaxSpec. If you configure both parameters, the value of IoMaxSpec takes effect. We recommend that you configure only IoMaxSpec.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='20'),
  ioMaxSpec?: string(name='IoMaxSpec', description='The traffic specification of the instance. We recommend that you configure this parameter.

*   You must configure at least one of IoMax and IoMaxSpec. If you configure both parameters, the value of IoMaxSpec takes effect. We recommend that you configure only IoMaxSpec.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='alikafka.hw.2xlarge'),
  paidType?: int32(name='PaidType', description='The billing method of the instance. Valid values:

*   1: pay-as-you-go (reserved capacity).
*   3: pay-as-you-go (reserved capacity) + pay-as-you-go (on-demand capacity)', example='1'),
  partitionNum?: int32(name='PartitionNum', description='The number of partitions. We recommend that you configure this parameter.

*   You must configure one of PartitionNum and TopicQuota. We recommend that you configure only ParittionNum.
*   If you configure PartitionNum and TopicQuota at the same time, the system verifies whether the price of the partitions equals the price of the topics based on the previous topic-based selling mode. If the price of the partitions does not equal the price of the topics, an error is returned. If the price of the partitions equals the price of the topics, the instance is purchased based on the partition number.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='50'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.

If this parameter is left empty, the default resource group is used. You can view the resource group ID on the Resource Group page in the Resource Management console.', example='rg-ac***********7q'),
  serverlessConfigShrink?: string(name='ServerlessConfig', description='The parameters configured for the serverless ApsaraMQ for Kafka instance. These parameters are required only when you create a serverless instance.'),
  specType?: string(name='SpecType', description='The instance edition.

Valid values if you set PaidType to 1:

*   normal: Standard Edition (High Write)
*   professional: Professional Edition (High Write)
*   professionalForHighRead: Professional Edition (High Read)

Valid values if you set PaidType to 3:

*   normal: Serverless Standard Edition

For more information about the instance editions, see [Billing](https://help.aliyun.com/document_detail/84737.html).', example='normal'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N.

*   Valid values of N: 1 to 20.
*   If this parameter is left empty, the keys of all tags are matched.
*   The tag key must be up to 128 characters in length. It cannot start with acs: or aliyun or contain [http:// or https://.](http://https://。)

This parameter is required.', example='FinanceDept'),
      value?: string(name='Value', description='The value of tag N.

*   Valid values of N: 1 to 20.
*   If you do not specify a tag key, you cannot specify a tag value. If this parameter is not configured, all tag values are matched.
*   The tag value must be 1 to 128 characters in length. It cannot start with acs: or aliyun or contain [http:// or https://.](http://https://。)', example='FinanceJoshua'),
    }
  ](name='Tag', description='The tags.'),
  topicQuota?: int32(name='TopicQuota', description='The number of topics. We recommend that you do not configure this parameter.

*   You must configure one of PartitionNum and TopicQuota. We recommend that you configure only ParittionNum.
*   If you configure PartitionNum and TopicQuota at the same time, the system verifies whether the price of the partitions equals the price of the topics based on the previous topic-based selling mode. If the price of the partitions does not equal the price of the topics, an error is returned. If the price of the partitions equals the price of the topics, the instance is purchased based on the partition number.
*   The default value of TopicQuota varies based on the value of IoMaxSpec. If the number of topics that you consume exceeds the default value, you are charged additional fees.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='50'),
}

model CreatePostPayOrderResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The message returned.', example='operation success.'),
  orderId?: string(name='OrderId', description='The ID of the order.', example='20497346575****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='06084011-E093-46F3-A51F-4B19A8AD****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model CreatePostPayOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreatePostPayOrderResponseBody(name='body'),
}

/**
 * @summary Creates a pay-as-you-go ApsaraMQ for Kafka instance. Pay-as-you-go instances allow you to pay after you use the resources. You are charged for pay-as-you-go instances based on the actual resource usage. You can use pay-as-you-go instances in test scenarios or scenarios in which the peak traffic is uncertain.
 *
 * @description Before you call this operation, make sure that you understand the billing method and pricing of pay-as-you-go Message Queue for Apache Kafka instances. For more information, see [Billing](https://help.aliyun.com/document_detail/84737.html).
 *
 * @param tmpReq CreatePostPayOrderRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreatePostPayOrderResponse
 */
async function createPostPayOrderWithOptions(tmpReq: CreatePostPayOrderRequest, runtime: Util.RuntimeOptions): CreatePostPayOrderResponse {
  Util.validateModel(tmpReq);
  var request = new CreatePostPayOrderShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.serverlessConfig)) {
    request.serverlessConfigShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.serverlessConfig, 'ServerlessConfig', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.deployType)) {
    query['DeployType'] = request.deployType;
  }
  if (!Util.isUnset(request.diskSize)) {
    query['DiskSize'] = request.diskSize;
  }
  if (!Util.isUnset(request.diskType)) {
    query['DiskType'] = request.diskType;
  }
  if (!Util.isUnset(request.eipMax)) {
    query['EipMax'] = request.eipMax;
  }
  if (!Util.isUnset(request.ioMax)) {
    query['IoMax'] = request.ioMax;
  }
  if (!Util.isUnset(request.ioMaxSpec)) {
    query['IoMaxSpec'] = request.ioMaxSpec;
  }
  if (!Util.isUnset(request.paidType)) {
    query['PaidType'] = request.paidType;
  }
  if (!Util.isUnset(request.partitionNum)) {
    query['PartitionNum'] = request.partitionNum;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.serverlessConfigShrink)) {
    query['ServerlessConfig'] = request.serverlessConfigShrink;
  }
  if (!Util.isUnset(request.specType)) {
    query['SpecType'] = request.specType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  if (!Util.isUnset(request.topicQuota)) {
    query['TopicQuota'] = request.topicQuota;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreatePostPayOrder',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a pay-as-you-go ApsaraMQ for Kafka instance. Pay-as-you-go instances allow you to pay after you use the resources. You are charged for pay-as-you-go instances based on the actual resource usage. You can use pay-as-you-go instances in test scenarios or scenarios in which the peak traffic is uncertain.
 *
 * @description Before you call this operation, make sure that you understand the billing method and pricing of pay-as-you-go Message Queue for Apache Kafka instances. For more information, see [Billing](https://help.aliyun.com/document_detail/84737.html).
 *
 * @param request CreatePostPayOrderRequest
 * @return CreatePostPayOrderResponse
 */
async function createPostPayOrder(request: CreatePostPayOrderRequest): CreatePostPayOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  return createPostPayOrderWithOptions(request, runtime);
}

model CreatePrePayInstanceRequest {
  confluentConfig?: {
    connectCU?: int32(name='ConnectCU', example='4'),
    connectReplica?: int32(name='ConnectReplica', example='2'),
    controlCenterCU?: int32(name='ControlCenterCU', example='4'),
    controlCenterReplica?: int32(name='ControlCenterReplica', example='1'),
    controlCenterStorage?: int32(name='ControlCenterStorage', example='300'),
    kafkaCU?: int32(name='KafkaCU', example='4'),
    kafkaReplica?: int32(name='KafkaReplica', example='3'),
    kafkaRestProxyCU?: int32(name='KafkaRestProxyCU', example='4'),
    kafkaRestProxyReplica?: int32(name='KafkaRestProxyReplica', example='2'),
    kafkaStorage?: int32(name='KafkaStorage', example='800'),
    ksqlCU?: int32(name='KsqlCU', example='4'),
    ksqlReplica?: int32(name='KsqlReplica', example='2'),
    ksqlStorage?: int32(name='KsqlStorage', example='100'),
    schemaRegistryCU?: int32(name='SchemaRegistryCU', example='1'),
    schemaRegistryReplica?: int32(name='SchemaRegistryReplica', example='2'),
    zooKeeperCU?: int32(name='ZooKeeperCU', example='2'),
    zooKeeperReplica?: int32(name='ZooKeeperReplica', example='3'),
    zooKeeperStorage?: int32(name='ZooKeeperStorage', example='100'),
  }(name='ConfluentConfig'),
  deployType?: int32(name='DeployType', example='5'),
  diskSize?: int32(name='DiskSize', example='500'),
  diskType?: string(name='DiskType', example='1'),
  duration?: int32(name='Duration', example='1'),
  eipMax?: int32(name='EipMax', example='3'),
  ioMaxSpec?: string(name='IoMaxSpec', example='alikafka.hw.2xlarge'),
  paidType?: int32(name='PaidType', example='1'),
  partitionNum?: int32(name='PartitionNum', example='1000'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-ac***********7q'),
  specType?: string(name='SpecType', example='professional'),
  tag?: [ 
    {
      key?: string(name='Key', description='This parameter is required.', example='FinanceDept'),
      value?: string(name='Value', example='test'),
    }
  ](name='Tag'),
}

model CreatePrePayInstanceShrinkRequest {
  confluentConfigShrink?: string(name='ConfluentConfig'),
  deployType?: int32(name='DeployType', example='5'),
  diskSize?: int32(name='DiskSize', example='500'),
  diskType?: string(name='DiskType', example='1'),
  duration?: int32(name='Duration', example='1'),
  eipMax?: int32(name='EipMax', example='3'),
  ioMaxSpec?: string(name='IoMaxSpec', example='alikafka.hw.2xlarge'),
  paidType?: int32(name='PaidType', example='1'),
  partitionNum?: int32(name='PartitionNum', example='1000'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', example='rg-ac***********7q'),
  specType?: string(name='SpecType', example='professional'),
  tag?: [ 
    {
      key?: string(name='Key', description='This parameter is required.', example='FinanceDept'),
      value?: string(name='Value', example='test'),
    }
  ](name='Tag'),
}

model CreatePrePayInstanceResponseBody = {
  code?: int32(name='Code', example='200'),
  data?: {
    instanceId?: string(name='InstanceId', example='alikafka_post-cn-xxxxxx'),
    orderId?: long(name='OrderId', example='236972661xxxx'),
  }(name='Data'),
  message?: string(name='Message', example='operation success'),
  requestId?: string(name='RequestId', example='E57A8862-DF68-4055-8E55-B80CB4****'),
  success?: boolean(name='Success', example='true'),
}

model CreatePrePayInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreatePrePayInstanceResponseBody(name='body'),
}

/**
 * @summary 创建预付费实例
 *
 * @param tmpReq CreatePrePayInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreatePrePayInstanceResponse
 */
async function createPrePayInstanceWithOptions(tmpReq: CreatePrePayInstanceRequest, runtime: Util.RuntimeOptions): CreatePrePayInstanceResponse {
  Util.validateModel(tmpReq);
  var request = new CreatePrePayInstanceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.confluentConfig)) {
    request.confluentConfigShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.confluentConfig, 'ConfluentConfig', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.confluentConfigShrink)) {
    query['ConfluentConfig'] = request.confluentConfigShrink;
  }
  if (!Util.isUnset(request.deployType)) {
    query['DeployType'] = request.deployType;
  }
  if (!Util.isUnset(request.diskSize)) {
    query['DiskSize'] = request.diskSize;
  }
  if (!Util.isUnset(request.diskType)) {
    query['DiskType'] = request.diskType;
  }
  if (!Util.isUnset(request.duration)) {
    query['Duration'] = request.duration;
  }
  if (!Util.isUnset(request.eipMax)) {
    query['EipMax'] = request.eipMax;
  }
  if (!Util.isUnset(request.ioMaxSpec)) {
    query['IoMaxSpec'] = request.ioMaxSpec;
  }
  if (!Util.isUnset(request.paidType)) {
    query['PaidType'] = request.paidType;
  }
  if (!Util.isUnset(request.partitionNum)) {
    query['PartitionNum'] = request.partitionNum;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.specType)) {
    query['SpecType'] = request.specType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreatePrePayInstance',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建预付费实例
 *
 * @param request CreatePrePayInstanceRequest
 * @return CreatePrePayInstanceResponse
 */
async function createPrePayInstance(request: CreatePrePayInstanceRequest): CreatePrePayInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return createPrePayInstanceWithOptions(request, runtime);
}

model CreatePrePayOrderRequest {
  confluentConfig?: {
    connectCU?: int32(name='ConnectCU', description='The number of CPU cores of Connect.', example='4'),
    connectReplica?: int32(name='ConnectReplica', description='The number of replicas of Connect.', example='2'),
    controlCenterCU?: int32(name='ControlCenterCU', description='The number of CPU cores of Control Center.', example='4'),
    controlCenterReplica?: int32(name='ControlCenterReplica', description='The number of replicas of Control Center.', example='1'),
    controlCenterStorage?: int32(name='ControlCenterStorage', description='The disk capacity of Control Center. Unit: GB', example='300'),
    kafkaCU?: int32(name='KafkaCU', description='The number of CPU cores of the Kafka broker.', example='4'),
    kafkaReplica?: int32(name='KafkaReplica', description='The number of replicas of the Kafka broker.', example='3'),
    kafkaRestProxyCU?: int32(name='KafkaRestProxyCU', description='The number of CPU cores of Kafka Rest Proxy.', example='4'),
    kafkaRestProxyReplica?: int32(name='KafkaRestProxyReplica', description='The number of replicas of Kafka Rest Proxy.', example='2'),
    kafkaStorage?: int32(name='KafkaStorage', description='The disk capacity of the Kafka broker. Unit: GB', example='800'),
    ksqlCU?: int32(name='KsqlCU', description='The number of CPU cores of ksqIDB.', example='4'),
    ksqlReplica?: int32(name='KsqlReplica', description='The number of replicas of ksqlDB.', example='2'),
    ksqlStorage?: int32(name='KsqlStorage', description='The disk capacity of ksqlDB. Unit: GB', example='100'),
    schemaRegistryCU?: int32(name='SchemaRegistryCU', description='The number of CPU cores of Schema Registry.', example='1'),
    schemaRegistryReplica?: int32(name='SchemaRegistryReplica', description='The number of replicas of Schema Registry.', example='2'),
    zooKeeperCU?: int32(name='ZooKeeperCU', description='The number of CPU cores of ZooKeeper.', example='2'),
    zooKeeperReplica?: int32(name='ZooKeeperReplica', description='The number of replicas of ZooKeeper.', example='3'),
    zooKeeperStorage?: int32(name='ZooKeeperStorage', description='The disk capacity of ZooKeeper. Unit: GB', example='100'),
  }(name='ConfluentConfig', description='The configurations of Confluent.

>  When you create an ApsaraMQ for Confluent instance, you must configure this parameter.'),
  deployType?: int32(name='DeployType', description='The type of the network in which the instance is deployed. Valid values:

*   **4**: Internet and virtual private cloud (VPC)
*   **5**: VPC

>  If you create an ApsaraMQ for Confluent instance, set the value to 5. After the instance is created, you can specify whether to enable each component.', example='5'),
  diskSize?: int32(name='DiskSize', description='The disk size. Unit: GB

For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='500'),
  diskType?: string(name='DiskType', description='The disk type. Valid values:

*   **0**: ultra disk
*   **1**: standard SSD

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='0'),
  duration?: int32(name='Duration', description='The subscription duration. Unit: months. Default value: 1. Valid values:

*   **1 to 12**', example='1'),
  eipMax?: int32(name='EipMax', description='The maximum Internet traffic in the instance.

*   If you set **DeployType** to **4**, you must configure this parameter.
*   For information about the valid values, see [Pay-as-you-go](https://help.aliyun.com/document_detail/72142.html).

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='0'),
  ioMax?: int32(name='IoMax', description='The maximum traffic in the instance. We recommend that you do not configure this parameter.

*   You must set one of **IoMax** and **IoMaxSpec**. If both parameters are configured, the value of **IoMaxSpec** is used. We recommend that you configure only **IoMaxSpec**.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='20'),
  ioMaxSpec?: string(name='IoMaxSpec', description='The traffic specification of the instance. We recommend that you configure this parameter.

*   You must configure one of **IoMax** and **IoMaxSpec**. If both parameters are configured, the value of **IoMaxSpec** is used. We recommend that you configure only **IoMaxSpec**.
*   For more information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='alikafka.hw.2xlarge'),
  paidType?: int32(name='PaidType', description='The billing method of the instance. Valid values:

*   **0**: the subscription billing method
*   **4**: the subscription billing method for ApsaraMQ for Confluent instances', example='1'),
  partitionNum?: int32(name='PartitionNum', description='The number of partitions. We recommend that you configure this parameter.

*   You must configure one of PartitionNum and TopicQuota. We recommend that you configure only PartitionNum.
*   If you configure PartitionNum and TopicQuota at the same time, the system verifies whether the price of the partitions equals the price of the topics based on the previous topic-based selling mode. If the price of the partitions does not equal the price of the topics, an error is returned. If the price of the partitions equals the price of the topics, the instance is purchased based on the partition number.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='50'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.

If this parameter is left empty, the default resource group is used. You can view the resource group ID on the Resource Group page in the Resource Management console.', example='rg-ac***********7q'),
  specType?: string(name='SpecType', description='The instance edition. Valid values:

*   **normal**: Standard Edition (High Write)
*   **professional**: Professional Edition (High Write)
*   **professionalForHighRead**: Professional Edition (High Read)

For more information, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='normal'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N.

*   Valid values of N: 1 to 20.
*   If this parameter is left empty, the keys of all tags are matched.
*   The tag key can be up to 128 characters in length and cannot start with acs: or aliyun or contain [http:// or https://.](http://https://。)

This parameter is required.', example='FinanceDept'),
      value?: string(name='Value', description='The value of tag N.

*   Valid values of N: 1 to 20.
*   This parameter can be left empty.
*   The tag value can be 1 to 128 characters in length and cannot start with acs: or aliyun or contain [http:// or https://.](http://https://。)', example='FinanceJoshua'),
    }
  ](name='Tag', description='The tags.'),
  topicQuota?: int32(name='TopicQuota', description='The number of topics. We recommend that you do not configure this parameter.

*   You must configure one of PartitionNum and TopicQuota. We recommend that you configure only PartitionNum.
*   If you configure PartitionNum and TopicQuota at the same time, the system verifies whether the price of the partitions equals the price of the topics based on the previous topic-based selling mode. If the price of the partitions does not equal the price of the topics, an error is returned. If the price of the partitions equals the price of the topics, the instance is purchased based on the partition number.
*   The default value of TopicQuota varies based on the value of IoMaxSpec. If the number of topics that you use exceeds the default value, you are charged additional fees.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='50'),
}

model CreatePrePayOrderShrinkRequest {
  confluentConfigShrink?: string(name='ConfluentConfig', description='The configurations of Confluent.

>  When you create an ApsaraMQ for Confluent instance, you must configure this parameter.'),
  deployType?: int32(name='DeployType', description='The type of the network in which the instance is deployed. Valid values:

*   **4**: Internet and virtual private cloud (VPC)
*   **5**: VPC

>  If you create an ApsaraMQ for Confluent instance, set the value to 5. After the instance is created, you can specify whether to enable each component.', example='5'),
  diskSize?: int32(name='DiskSize', description='The disk size. Unit: GB

For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='500'),
  diskType?: string(name='DiskType', description='The disk type. Valid values:

*   **0**: ultra disk
*   **1**: standard SSD

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='0'),
  duration?: int32(name='Duration', description='The subscription duration. Unit: months. Default value: 1. Valid values:

*   **1 to 12**', example='1'),
  eipMax?: int32(name='EipMax', description='The maximum Internet traffic in the instance.

*   If you set **DeployType** to **4**, you must configure this parameter.
*   For information about the valid values, see [Pay-as-you-go](https://help.aliyun.com/document_detail/72142.html).

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='0'),
  ioMax?: int32(name='IoMax', description='The maximum traffic in the instance. We recommend that you do not configure this parameter.

*   You must set one of **IoMax** and **IoMaxSpec**. If both parameters are configured, the value of **IoMaxSpec** is used. We recommend that you configure only **IoMaxSpec**.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='20'),
  ioMaxSpec?: string(name='IoMaxSpec', description='The traffic specification of the instance. We recommend that you configure this parameter.

*   You must configure one of **IoMax** and **IoMaxSpec**. If both parameters are configured, the value of **IoMaxSpec** is used. We recommend that you configure only **IoMaxSpec**.
*   For more information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='alikafka.hw.2xlarge'),
  paidType?: int32(name='PaidType', description='The billing method of the instance. Valid values:

*   **0**: the subscription billing method
*   **4**: the subscription billing method for ApsaraMQ for Confluent instances', example='1'),
  partitionNum?: int32(name='PartitionNum', description='The number of partitions. We recommend that you configure this parameter.

*   You must configure one of PartitionNum and TopicQuota. We recommend that you configure only PartitionNum.
*   If you configure PartitionNum and TopicQuota at the same time, the system verifies whether the price of the partitions equals the price of the topics based on the previous topic-based selling mode. If the price of the partitions does not equal the price of the topics, an error is returned. If the price of the partitions equals the price of the topics, the instance is purchased based on the partition number.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='50'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.

If this parameter is left empty, the default resource group is used. You can view the resource group ID on the Resource Group page in the Resource Management console.', example='rg-ac***********7q'),
  specType?: string(name='SpecType', description='The instance edition. Valid values:

*   **normal**: Standard Edition (High Write)
*   **professional**: Professional Edition (High Write)
*   **professionalForHighRead**: Professional Edition (High Read)

For more information, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='normal'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N.

*   Valid values of N: 1 to 20.
*   If this parameter is left empty, the keys of all tags are matched.
*   The tag key can be up to 128 characters in length and cannot start with acs: or aliyun or contain [http:// or https://.](http://https://。)

This parameter is required.', example='FinanceDept'),
      value?: string(name='Value', description='The value of tag N.

*   Valid values of N: 1 to 20.
*   This parameter can be left empty.
*   The tag value can be 1 to 128 characters in length and cannot start with acs: or aliyun or contain [http:// or https://.](http://https://。)', example='FinanceJoshua'),
    }
  ](name='Tag', description='The tags.'),
  topicQuota?: int32(name='TopicQuota', description='The number of topics. We recommend that you do not configure this parameter.

*   You must configure one of PartitionNum and TopicQuota. We recommend that you configure only PartitionNum.
*   If you configure PartitionNum and TopicQuota at the same time, the system verifies whether the price of the partitions equals the price of the topics based on the previous topic-based selling mode. If the price of the partitions does not equal the price of the topics, an error is returned. If the price of the partitions equals the price of the topics, the instance is purchased based on the partition number.
*   The default value of TopicQuota varies based on the value of IoMaxSpec. If the number of topics that you use exceeds the default value, you are charged additional fees.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If you create an ApsaraMQ for Confluent instance, you do not need to configure this parameter.', example='50'),
}

model CreatePrePayOrderResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The message returned.', example='operation success.'),
  orderId?: string(name='OrderId', description='The ID of the order.', example='20497346575****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='06084011-E093-46F3-A51F-4B19A8AD****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model CreatePrePayOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreatePrePayOrderResponseBody(name='body'),
}

/**
 * @summary Creates a subscription ApsaraMQ for Kafka instance. You can use subscription instances only after you pay for them. Subscription instances are suitable for long-term and stable business scenarios.
 *
 * @description *   Before you call this operation, make sure that you understand the billing methods and pricing of subscription ApsaraMQ for Kafka instances. For more information, see [Billing](https://help.aliyun.com/document_detail/84737.html).
 * *   If you create an ApsaraMQ for Kafka instance by calling this operation, the subscription duration is one month and the auto-renewal feature is enabled by default. The auto-renewal cycle is also one month. If you want to change the auto-renewal cycle or disable the auto-renewal feature, you can go to the [Renewal](https://renew.console.aliyun.com/#/ecs) page in the Alibaba Cloud Management Console.
 *
 * @param tmpReq CreatePrePayOrderRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreatePrePayOrderResponse
 */
async function createPrePayOrderWithOptions(tmpReq: CreatePrePayOrderRequest, runtime: Util.RuntimeOptions): CreatePrePayOrderResponse {
  Util.validateModel(tmpReq);
  var request = new CreatePrePayOrderShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.confluentConfig)) {
    request.confluentConfigShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.confluentConfig, 'ConfluentConfig', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.confluentConfigShrink)) {
    query['ConfluentConfig'] = request.confluentConfigShrink;
  }
  if (!Util.isUnset(request.deployType)) {
    query['DeployType'] = request.deployType;
  }
  if (!Util.isUnset(request.diskSize)) {
    query['DiskSize'] = request.diskSize;
  }
  if (!Util.isUnset(request.diskType)) {
    query['DiskType'] = request.diskType;
  }
  if (!Util.isUnset(request.duration)) {
    query['Duration'] = request.duration;
  }
  if (!Util.isUnset(request.eipMax)) {
    query['EipMax'] = request.eipMax;
  }
  if (!Util.isUnset(request.ioMax)) {
    query['IoMax'] = request.ioMax;
  }
  if (!Util.isUnset(request.ioMaxSpec)) {
    query['IoMaxSpec'] = request.ioMaxSpec;
  }
  if (!Util.isUnset(request.paidType)) {
    query['PaidType'] = request.paidType;
  }
  if (!Util.isUnset(request.partitionNum)) {
    query['PartitionNum'] = request.partitionNum;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.specType)) {
    query['SpecType'] = request.specType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  if (!Util.isUnset(request.topicQuota)) {
    query['TopicQuota'] = request.topicQuota;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreatePrePayOrder',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a subscription ApsaraMQ for Kafka instance. You can use subscription instances only after you pay for them. Subscription instances are suitable for long-term and stable business scenarios.
 *
 * @description *   Before you call this operation, make sure that you understand the billing methods and pricing of subscription ApsaraMQ for Kafka instances. For more information, see [Billing](https://help.aliyun.com/document_detail/84737.html).
 * *   If you create an ApsaraMQ for Kafka instance by calling this operation, the subscription duration is one month and the auto-renewal feature is enabled by default. The auto-renewal cycle is also one month. If you want to change the auto-renewal cycle or disable the auto-renewal feature, you can go to the [Renewal](https://renew.console.aliyun.com/#/ecs) page in the Alibaba Cloud Management Console.
 *
 * @param request CreatePrePayOrderRequest
 * @return CreatePrePayOrderResponse
 */
async function createPrePayOrder(request: CreatePrePayOrderRequest): CreatePrePayOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  return createPrePayOrderWithOptions(request, runtime);
}

model CreateSaslUserRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_pre-cn-v0h1cng0****'),
  mechanism?: string(name='Mechanism', description='The encryption method. Valid values:

*   SCRAM-SHA-512 (default)
*   SCRAM-SHA-256

>  This parameter is available only for ApsaraMQ for Kafka serverless instances.', example='SCRAM-SHA-256'),
  password?: string(name='Password', description='The password of the SASL user.

This parameter is required.', example='12***'),
  regionId?: string(name='RegionId', description='The region ID.

This parameter is required.', example='cn-hangzhou'),
  type?: string(name='Type', description='The type of the Simple Authentication and Security Layer (SASL) user. Valid values:

*   **plain**: a simple mechanism that uses usernames and passwords to verify user identities. ApsaraMQ for Kafka provides an improved PLAIN mechanism that allows you to dynamically add SASL users without the need to restart an instance.
*   **SCRAM**: a mechanism that uses usernames and passwords to verify user identities. Compared with the PLAIN mechanism, this mechanism provides better security protection. ApsaraMQ for Kafka uses the SCRAM-SHA-256 algorithm.
*   **LDAP**: This value is available only for the SASL users of ApsaraMQ for Confluent instances.

Default value: **plain**.', example='plain'),
  username?: string(name='Username', description='The name of the SASL user.

This parameter is required.', example='test***'),
}

model CreateSaslUserResponseBody = {
  code?: int32(name='Code', description='The HTTP status code. The HTTP status code 200 indicates that the request was successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The request ID.', example='C5CA600C-7D5A-45B5-B6DB-44FAC2C****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='true'),
}

model CreateSaslUserResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateSaslUserResponseBody(name='body'),
}

/**
 * @summary Creates a Simple Authentication and Security Layer (SASL) user.
 *
 * @param request CreateSaslUserRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateSaslUserResponse
 */
async function createSaslUserWithOptions(request: CreateSaslUserRequest, runtime: Util.RuntimeOptions): CreateSaslUserResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.mechanism)) {
    query['Mechanism'] = request.mechanism;
  }
  if (!Util.isUnset(request.password)) {
    query['Password'] = request.password;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  if (!Util.isUnset(request.username)) {
    query['Username'] = request.username;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateSaslUser',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a Simple Authentication and Security Layer (SASL) user.
 *
 * @param request CreateSaslUserRequest
 * @return CreateSaslUserResponse
 */
async function createSaslUser(request: CreateSaslUserRequest): CreateSaslUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return createSaslUserWithOptions(request, runtime);
}

model CreateScheduledScalingRuleRequest {
  durationMinutes?: int32(name='DurationMinutes', description='The duration of each scheduled scaling task. Unit: minutes.

>  The value of this parameter must be greater than or equal to 15.

This parameter is required.', example='60'),
  enable?: boolean(name='Enable', description='Specifies whether to enable the scheduled scaling rule. Valid values:

*   **true**
*   **false**', example='true'),
  firstScheduledTime?: long(name='FirstScheduledTime', description='The time when the scheduled scaling task is executed.

If you set ScheduleType to at, make sure that the value of this parameter is at least 30 minutes later than the current point in time.

>Notice: To prevent the broker from repeatedly executing instance upgrade and downgrade tasks, make sure that the interval between two consecutive scheduled scaling tasks is at least 60 minutes.

This parameter is required.', example='1714467540000'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_serverless-cn-vxxxxxxxx'),
  regionId?: string(name='RegionId', description='The ID of the region where the instance resides.

This parameter is required.', example='cn-hangzhou'),
  repeatType?: string(name='RepeatType', description='The frequency to execute the scheduled scaling task. This parameter is required only if you set ScheduleType to repeat. Valid values:

*   Daily: The scheduled scaling task is executed every day.

*   Weekly: The scheduled scaling task is executed every week.', example='Weekly'),
  reservedPubFlow?: int32(name='ReservedPubFlow', description='The reserved production capacity for scheduled scaling. Unit: MB/s.

>  You must specify a higher value than the instance specification for at least one of ReservedPubFlow and ReservedSubFlow.

This parameter is required.', example='120'),
  reservedSubFlow?: int32(name='ReservedSubFlow', description='The reserved consumption capacity for scheduled scaling. Unit: MB/s.

>  You must specify a higher value than the instance specification for at least one of ReservedPubFlow and ReservedSubFlow.

This parameter is required.', example='120'),
  ruleName?: string(name='RuleName', description='The name of the scheduled scaling rule.

>  The name of the scheduled scaling rule cannot be the same as the names of other rules for the instance.

This parameter is required.', example='test'),
  scheduleType?: string(name='ScheduleType', description='The type of the scheduled scaling task. Valid values:

*   at: The scheduled scaling task is executed only once.
*   repeat: The scheduled scaling task is repeatedly executed.

This parameter is required.', example='at'),
  timeZone?: string(name='TimeZone', description='The time zone in Coordinated Universal Time (UTC).

This parameter is required.', example='GMT+8'),
  weeklyTypes?: [ string ](name='WeeklyTypes', description='The day on which the scheduled scaling task is executed every week. You can specify multiple days.'),
}

model CreateScheduledScalingRuleShrinkRequest {
  durationMinutes?: int32(name='DurationMinutes', description='The duration of each scheduled scaling task. Unit: minutes.

>  The value of this parameter must be greater than or equal to 15.

This parameter is required.', example='60'),
  enable?: boolean(name='Enable', description='Specifies whether to enable the scheduled scaling rule. Valid values:

*   **true**
*   **false**', example='true'),
  firstScheduledTime?: long(name='FirstScheduledTime', description='The time when the scheduled scaling task is executed.

If you set ScheduleType to at, make sure that the value of this parameter is at least 30 minutes later than the current point in time.

>Notice: To prevent the broker from repeatedly executing instance upgrade and downgrade tasks, make sure that the interval between two consecutive scheduled scaling tasks is at least 60 minutes.

This parameter is required.', example='1714467540000'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_serverless-cn-vxxxxxxxx'),
  regionId?: string(name='RegionId', description='The ID of the region where the instance resides.

This parameter is required.', example='cn-hangzhou'),
  repeatType?: string(name='RepeatType', description='The frequency to execute the scheduled scaling task. This parameter is required only if you set ScheduleType to repeat. Valid values:

*   Daily: The scheduled scaling task is executed every day.

*   Weekly: The scheduled scaling task is executed every week.', example='Weekly'),
  reservedPubFlow?: int32(name='ReservedPubFlow', description='The reserved production capacity for scheduled scaling. Unit: MB/s.

>  You must specify a higher value than the instance specification for at least one of ReservedPubFlow and ReservedSubFlow.

This parameter is required.', example='120'),
  reservedSubFlow?: int32(name='ReservedSubFlow', description='The reserved consumption capacity for scheduled scaling. Unit: MB/s.

>  You must specify a higher value than the instance specification for at least one of ReservedPubFlow and ReservedSubFlow.

This parameter is required.', example='120'),
  ruleName?: string(name='RuleName', description='The name of the scheduled scaling rule.

>  The name of the scheduled scaling rule cannot be the same as the names of other rules for the instance.

This parameter is required.', example='test'),
  scheduleType?: string(name='ScheduleType', description='The type of the scheduled scaling task. Valid values:

*   at: The scheduled scaling task is executed only once.
*   repeat: The scheduled scaling task is repeatedly executed.

This parameter is required.', example='at'),
  timeZone?: string(name='TimeZone', description='The time zone in Coordinated Universal Time (UTC).

This parameter is required.', example='GMT+8'),
  weeklyTypesShrink?: string(name='WeeklyTypes', description='The day on which the scheduled scaling task is executed every week. You can specify multiple days.'),
}

model CreateScheduledScalingRuleResponseBody = {
  code?: long(name='Code', description='The response code. The value 200 indicates that the request was successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success'),
  requestId?: string(name='RequestId', description='The request ID.', example='DB6F1BEA-903B-4FD8-8809-46E7E9CE***'),
  success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='True'),
}

model CreateScheduledScalingRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateScheduledScalingRuleResponseBody(name='body'),
}

/**
 * @summary Creates a scheduled scaling rule for a serverless ApsaraMQ for Kafka V3 instance.
 *
 * @description ###### [](#-v3-serverless-)This operation is supported only by serverless ApsaraMQ for Kafka V3 instances.
 *
 * @param tmpReq CreateScheduledScalingRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateScheduledScalingRuleResponse
 */
async function createScheduledScalingRuleWithOptions(tmpReq: CreateScheduledScalingRuleRequest, runtime: Util.RuntimeOptions): CreateScheduledScalingRuleResponse {
  Util.validateModel(tmpReq);
  var request = new CreateScheduledScalingRuleShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.weeklyTypes)) {
    request.weeklyTypesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.weeklyTypes, 'WeeklyTypes', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.durationMinutes)) {
    query['DurationMinutes'] = request.durationMinutes;
  }
  if (!Util.isUnset(request.enable)) {
    query['Enable'] = request.enable;
  }
  if (!Util.isUnset(request.firstScheduledTime)) {
    query['FirstScheduledTime'] = request.firstScheduledTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.repeatType)) {
    query['RepeatType'] = request.repeatType;
  }
  if (!Util.isUnset(request.reservedPubFlow)) {
    query['ReservedPubFlow'] = request.reservedPubFlow;
  }
  if (!Util.isUnset(request.reservedSubFlow)) {
    query['ReservedSubFlow'] = request.reservedSubFlow;
  }
  if (!Util.isUnset(request.ruleName)) {
    query['RuleName'] = request.ruleName;
  }
  if (!Util.isUnset(request.scheduleType)) {
    query['ScheduleType'] = request.scheduleType;
  }
  if (!Util.isUnset(request.timeZone)) {
    query['TimeZone'] = request.timeZone;
  }
  if (!Util.isUnset(request.weeklyTypesShrink)) {
    query['WeeklyTypes'] = request.weeklyTypesShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateScheduledScalingRule',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a scheduled scaling rule for a serverless ApsaraMQ for Kafka V3 instance.
 *
 * @description ###### [](#-v3-serverless-)This operation is supported only by serverless ApsaraMQ for Kafka V3 instances.
 *
 * @param request CreateScheduledScalingRuleRequest
 * @return CreateScheduledScalingRuleResponse
 */
async function createScheduledScalingRule(request: CreateScheduledScalingRuleRequest): CreateScheduledScalingRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return createScheduledScalingRuleWithOptions(request, runtime);
}

model CreateTopicRequest {
  compactTopic?: boolean(name='CompactTopic', description='The log cleanup policy that is used for the topic. This parameter is available only when LocalTopic is set to true. Valid values:

*   false: The topic uses the default log cleanup policy.
*   true: The topic uses the log compaction policy.', example='false'),
  config?: string(name='Config', description='The additional configuration.

*   The value must be in JSON format.
*   Set Key to **replications**. This value specifies the number of replicas of the topic. The value must be an integer that ranges from 1 to 3.
*   You can configure this parameter only if you set **LocalTopic** to **true** or specify **Open Source Edition (Local Disk)** as the instance edition.****

>  If you specify replications in this parameter, **ReplicationFactor** does not take effect.', example='{"replications": 3}', nullable=true),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_pre-cn-mp919o4v****'),
  localTopic?: boolean(name='LocalTopic', description='The type of storage that the topic uses. Valid values:

*   false: The topic uses cloud storage.
*   true: The topic uses local storage.', example='false'),
  minInsyncReplicas?: long(name='MinInsyncReplicas', description='The minimum number of in-sync replicas (ISRs).

*   This parameter is available only when **LocalTopic** is set to **true**, or the instance is of the **Open Source Edition (Local Disk)**.****
*   The value of this parameter must be smaller than the value of ReplicationFactor.
*   Valid values: 1 to 3.', example='1', nullable=true),
  partitionNum?: string(name='PartitionNum', description='The number of partitions in the topic.

*   Valid values: 1 to 360.
*   In the ApsaraMQ for Kafka console, you can view the number of partitions that the system recommends based on the specifications of the instance. We recommend that you specify the number that is recommended by the system as the value of this parameter to reduce the risk of data skew.

Default values:

*   ApsaraMQ for Kafka V2 instance: 12
*   ApsaraMQ for Kafka V3 instance: 3', example='12'),
  regionId?: string(name='RegionId', description='The region ID of the instance in which you want to create a topic.

This parameter is required.', example='cn-hangzhou'),
  remark?: string(name='Remark', description='The description of the topic.

*   The description can contain only letters, digits, hyphens (-), and underscores (_).
*   The description must be 3 to 64 characters in length.

This parameter is required.', example='alikafka_topic_test'),
  replicationFactor?: long(name='ReplicationFactor', description='The number of replicas for the topic.

*   This parameter is available only when **LocalTopic** is set to **true**, or the instance is of the **Open Source Edition (Local Disk)**.****
*   Valid values: 1 to 3.

> If you set this parameter to **1**, data loss may occur. Exercise caution when you configure this parameter.', example='3', nullable=true),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key.

*   If you do not specify this parameter, the keys of all tags are matched.
*   The tag key must be 1 to 128 characters in length and cannot contain `http://` or `https://`. The tag key cannot start with `aliyun` or `acs:`.

This parameter is required.', example='FinanceDept'),
      value?: string(name='Value', description='The tag value.

*   You can leave this parameter empty.
*   The tag value must be 1 to 128 characters in length and cannot contain http:// or https://. The tag value cannot start with aliyun or acs:.', example='FinanceJoshua'),
    }
  ](name='Tag', description='The tags that you want to add to the topic.'),
  topic?: string(name='Topic', description='The topic name.

*   The name can contain only letters, digits, hyphens (-), and underscores (_).
*   The name must be 3 to 64 characters in length. If the name that you specify contains more than 64 characters, the system automatically truncates the name.
*   After a topic is created, you cannot change the name of the topic.

This parameter is required.', example='alikafka_topic_test'),
}

model CreateTopicResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the call is successful.', example='200'),
  message?: string(name='Message', description='The message returned.', example='operation success'),
  requestId?: string(name='RequestId', description='The request ID.', example='9C0F207C-77A6-43E5-991C-9D98510A****'),
  success?: boolean(name='Success', description='Indicates whether the call was successful.', example='true'),
}

model CreateTopicResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateTopicResponseBody(name='body'),
}

/**
 * @summary Creates a topic.
 *
 * @description *   Each Alibaba Cloud account can call this operation up to once per second.
 * *   The maximum number of topics that you can create in an instance is determined by the specification of the instance.
 *
 * @param request CreateTopicRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateTopicResponse
 */
async function createTopicWithOptions(request: CreateTopicRequest, runtime: Util.RuntimeOptions): CreateTopicResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.compactTopic)) {
    query['CompactTopic'] = request.compactTopic;
  }
  if (!Util.isUnset(request.config)) {
    query['Config'] = request.config;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.localTopic)) {
    query['LocalTopic'] = request.localTopic;
  }
  if (!Util.isUnset(request.minInsyncReplicas)) {
    query['MinInsyncReplicas'] = request.minInsyncReplicas;
  }
  if (!Util.isUnset(request.partitionNum)) {
    query['PartitionNum'] = request.partitionNum;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.replicationFactor)) {
    query['ReplicationFactor'] = request.replicationFactor;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  if (!Util.isUnset(request.topic)) {
    query['Topic'] = request.topic;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateTopic',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a topic.
 *
 * @description *   Each Alibaba Cloud account can call this operation up to once per second.
 * *   The maximum number of topics that you can create in an instance is determined by the specification of the instance.
 *
 * @param request CreateTopicRequest
 * @return CreateTopicResponse
 */
async function createTopic(request: CreateTopicRequest): CreateTopicResponse {
  var runtime = new Util.RuntimeOptions{};
  return createTopicWithOptions(request, runtime);
}

model DeleteAclRequest {
  aclOperationType?: string(name='AclOperationType', description='The type of the operation allowed by the access control list (ACL). Valid values:

*   **Write**: data writes.
*   **Read**: data reads.
*   **Describe**: reads of transaction IDs.
*   **IdempotentWrite**: idempotent data writes to clusters.
*   **IDEMPOTENT_WRITE**: idempotent data writes to clusters. This value is available only for serverless ApsaraMQ for Kafka instances.
*   **DESCRIBE_CONFIGS**: configuration query. This value is available only for serverless ApsaraMQ for Kafka instances.

This parameter is required.', example='Write'),
  aclOperationTypes?: string(name='AclOperationTypes', description='The types of operations allowed by the ACL. Separate multiple operations with commas (,).

Valid values:

*   **Write**: data writes.
*   **Read**: data reads.
*   **Describe**: reads of transaction IDs.
*   **IdempotentWrite**: idempotent data writes to clusters.
*   **IDEMPOTENT_WRITE**: idempotent data writes to clusters. This value is available only for serverless ApsaraMQ for Kafka instances.
*   **DESCRIBE_CONFIGS**: configuration query. This value is available only for serverless ApsaraMQ for Kafka instances.

>  This parameter is available only for serverless ApsaraMQ for Kafka instances.', example='Write,Read'),
  aclPermissionType?: string(name='AclPermissionType', description='The authorization method. Valid values:

*   Deny
*   ALLOW

>  This parameter is available only for serverless ApsaraMQ for Kafka instances.', example='DENY'),
  aclResourceName?: string(name='AclResourceName', description='The name of the resource.

*   The value can be the name of a topic or consumer group.
*   You can use an asterisk (\\\\*) to indicate the names of all topics or consumer groups.

This parameter is required.', example='demo'),
  aclResourcePatternType?: string(name='AclResourcePatternType', description='The mode that is used to match resources. Valid values:

*   **LITERAL:** full match
*   **PREFIXED**: prefix match

This parameter is required.', example='LITERAL'),
  aclResourceType?: string(name='AclResourceType', description='The resource type. Valid values:

*   **Topic**: topic
*   **Group**: consumer group
*   **Cluster**: cluster
*   **TransactionalId**: transactional ID

This parameter is required.', example='Topic'),
  host?: string(name='Host', description='The IP address of the source.

> 

*   You can specify only a specific IP address or use the asterisk (\\\\*) wildcard character to specify all IP addresses. CIDR blocks are not supported.

*   This parameter is available only for serverless ApsaraMQ for Kafka instances.', example='*'),
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_pre-cn-v0h1cng0****'),
  regionId?: string(name='RegionId', description='The ID of the region.

This parameter is required.', example='cn-hangzhou'),
  username?: string(name='Username', description='The name of the user.

This parameter is required.', example='test12****'),
}

model DeleteAclResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The message returned.', example='operation success'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='B0740227-AA9A-4E14-8E9F-36ED665****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model DeleteAclResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteAclResponseBody(name='body'),
}

/**
 * @summary Deletes an access control list (ACL).
 *
 * @param request DeleteAclRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteAclResponse
 */
async function deleteAclWithOptions(request: DeleteAclRequest, runtime: Util.RuntimeOptions): DeleteAclResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.aclOperationType)) {
    query['AclOperationType'] = request.aclOperationType;
  }
  if (!Util.isUnset(request.aclOperationTypes)) {
    query['AclOperationTypes'] = request.aclOperationTypes;
  }
  if (!Util.isUnset(request.aclPermissionType)) {
    query['AclPermissionType'] = request.aclPermissionType;
  }
  if (!Util.isUnset(request.aclResourceName)) {
    query['AclResourceName'] = request.aclResourceName;
  }
  if (!Util.isUnset(request.aclResourcePatternType)) {
    query['AclResourcePatternType'] = request.aclResourcePatternType;
  }
  if (!Util.isUnset(request.aclResourceType)) {
    query['AclResourceType'] = request.aclResourceType;
  }
  if (!Util.isUnset(request.host)) {
    query['Host'] = request.host;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.username)) {
    query['Username'] = request.username;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteAcl',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes an access control list (ACL).
 *
 * @param request DeleteAclRequest
 * @return DeleteAclResponse
 */
async function deleteAcl(request: DeleteAclRequest): DeleteAclResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteAclWithOptions(request, runtime);
}

model DeleteConsumerGroupRequest {
  consumerId?: string(name='ConsumerId', description='The name of the consumer group.

This parameter is required.', example='CID-test'),
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_post-cn-v0h1fgs2****'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
}

model DeleteConsumerGroupResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='06084011-E093-46F3-A51F-4B19A8AD****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model DeleteConsumerGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteConsumerGroupResponseBody(name='body'),
}

/**
 * @summary Deletes a consumer group from a specified Message Queue for Apache Kafka instance.
 *
 * @param request DeleteConsumerGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteConsumerGroupResponse
 */
async function deleteConsumerGroupWithOptions(request: DeleteConsumerGroupRequest, runtime: Util.RuntimeOptions): DeleteConsumerGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.consumerId)) {
    query['ConsumerId'] = request.consumerId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteConsumerGroup',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a consumer group from a specified Message Queue for Apache Kafka instance.
 *
 * @param request DeleteConsumerGroupRequest
 * @return DeleteConsumerGroupResponse
 */
async function deleteConsumerGroup(request: DeleteConsumerGroupRequest): DeleteConsumerGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteConsumerGroupWithOptions(request, runtime);
}

model DeleteInstanceRequest {
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_post-cn-mp919o4v****'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
}

model DeleteInstanceResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='ABA4A7FD-E10F-45C7-9774-A5236015****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model DeleteInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteInstanceResponseBody(name='body'),
}

/**
 * @summary Deletes an instance. You can delete subscription and pay-as-you-go instances after you release them.
 *
 * @param request DeleteInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteInstanceResponse
 */
async function deleteInstanceWithOptions(request: DeleteInstanceRequest, runtime: Util.RuntimeOptions): DeleteInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteInstance',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes an instance. You can delete subscription and pay-as-you-go instances after you release them.
 *
 * @param request DeleteInstanceRequest
 * @return DeleteInstanceResponse
 */
async function deleteInstance(request: DeleteInstanceRequest): DeleteInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteInstanceWithOptions(request, runtime);
}

model DeleteSaslUserRequest {
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_pre-cn-v0h1cng0****'),
  mechanism?: string(name='Mechanism', description='The encryption method. Valid values:

*   SCRAM-SHA-512. This is the default value.
*   SCRAM-SHA-256

>  This parameter is available only for serverless ApsaraMQ for Kafka instances.', example='SCRAM-SHA-256'),
  regionId?: string(name='RegionId', description='The ID of the region.

This parameter is required.', example='cn-hangzhou'),
  type?: string(name='Type', description='The type of the Simple Authentication and Security Layer (SASL) user. Valid values:

*   **plain**: a simple mechanism that uses usernames and passwords to verify user identities. ApsaraMQ for Kafka provides an improved PLAIN mechanism that allows you to dynamically add SASL users without the need to restart an instance.
*   **SCRAM**: a mechanism that uses usernames and passwords to verify user identities. Compared with the PLAIN mechanism, this mechanism provides better security protection. ApsaraMQ for Kafka uses the SCRAM-SHA-256 algorithm.
*   **LDAP**: This value is available only for the SASL users of ApsaraMQ for Confluent instances.

Default value: **plain**.', example='scram'),
  username?: string(name='Username', description='The name of the user.

This parameter is required.', example='test***'),
}

model DeleteSaslUserResponseBody = {
  code?: int32(name='Code', description='The HTTP status code. If the request is successful, 200 is returned.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success'),
  requestId?: string(name='RequestId', description='The request ID.', example='3CB89F5C-CD97-4C1D-BC7C-FEDEC2F4****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model DeleteSaslUserResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteSaslUserResponseBody(name='body'),
}

/**
 * @summary Deletes a Simple Authentication and Security Layer (SASL) user.
 *
 * @param request DeleteSaslUserRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteSaslUserResponse
 */
async function deleteSaslUserWithOptions(request: DeleteSaslUserRequest, runtime: Util.RuntimeOptions): DeleteSaslUserResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.mechanism)) {
    query['Mechanism'] = request.mechanism;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  if (!Util.isUnset(request.username)) {
    query['Username'] = request.username;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteSaslUser',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a Simple Authentication and Security Layer (SASL) user.
 *
 * @param request DeleteSaslUserRequest
 * @return DeleteSaslUserResponse
 */
async function deleteSaslUser(request: DeleteSaslUserRequest): DeleteSaslUserResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteSaslUserWithOptions(request, runtime);
}

model DeleteScheduledScalingRuleRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_serverless-cn-vxxxxxxxx'),
  regionId?: string(name='RegionId', description='The ID of the region where the instance resides.

This parameter is required.', example='cn-hangzhou'),
  ruleName?: string(name='RuleName', description='The name of the scheduled scaling rule.

>  You can delete only rules that are disabled and rules that are scheduled only once and have been executed.

This parameter is required.', example='rule-name-test'),
}

model DeleteScheduledScalingRuleResponseBody = {
  code?: long(name='Code', description='The responses code. The value 200 indicates that the request was successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABA4A7FD-E10F-45C7-9774-A5236015****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='True'),
}

model DeleteScheduledScalingRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteScheduledScalingRuleResponseBody(name='body'),
}

/**
 * @summary Deletes the scheduled scaling policy of a serverless ApsaraMQ for Kafka instance after you deploy the instance.
 *
 * @description ###### [](#-serverless-)This operation is available only for serverless ApsaraMQ for Kafka instances.
 *
 * @param request DeleteScheduledScalingRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteScheduledScalingRuleResponse
 */
async function deleteScheduledScalingRuleWithOptions(request: DeleteScheduledScalingRuleRequest, runtime: Util.RuntimeOptions): DeleteScheduledScalingRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.ruleName)) {
    query['RuleName'] = request.ruleName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteScheduledScalingRule',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes the scheduled scaling policy of a serverless ApsaraMQ for Kafka instance after you deploy the instance.
 *
 * @description ###### [](#-serverless-)This operation is available only for serverless ApsaraMQ for Kafka instances.
 *
 * @param request DeleteScheduledScalingRuleRequest
 * @return DeleteScheduledScalingRuleResponse
 */
async function deleteScheduledScalingRule(request: DeleteScheduledScalingRuleRequest): DeleteScheduledScalingRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteScheduledScalingRuleWithOptions(request, runtime);
}

model DeleteTopicRequest {
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_post-cn-v0h1fgs2****'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  topic?: string(name='Topic', description='The name of the topic.

This parameter is required.', example='test'),
}

model DeleteTopicResponseBody = {
  code?: int32(name='Code', description='The HTTP status code. The status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The request ID.', example='06084011-E093-46F3-A51F-4B19A8AD****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model DeleteTopicResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteTopicResponseBody(name='body'),
}

/**
 * @summary Deletes a topic.
 *
 * @param request DeleteTopicRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteTopicResponse
 */
async function deleteTopicWithOptions(request: DeleteTopicRequest, runtime: Util.RuntimeOptions): DeleteTopicResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.topic)) {
    query['Topic'] = request.topic;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteTopic',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a topic.
 *
 * @param request DeleteTopicRequest
 * @return DeleteTopicResponse
 */
async function deleteTopic(request: DeleteTopicRequest): DeleteTopicResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteTopicWithOptions(request, runtime);
}

model DescribeAclResourceNameRequest {
  aclResourcePatternType?: string(name='AclResourcePatternType', description='This parameter is required.', example='LITERAL'),
  aclResourceType?: string(name='AclResourceType', description='This parameter is required.', example='Topic'),
  instanceId?: string(name='InstanceId', description='This parameter is required.', example='alikafka_post-cn-mp919o4v****'),
  regionId?: string(name='RegionId', description='This parameter is required.', example='cn-hangzhou'),
}

model DescribeAclResourceNameResponseBody = {
  code?: int32(name='Code', example='200'),
  data?: {
    data?: [ string ](name='data')
  }(name='Data'),
  message?: string(name='Message', example='operation success.'),
  requestId?: string(name='RequestId', example='ABA4A7FD-E10F-45C7-9774-A5236015A***'),
  success?: boolean(name='Success', example='true'),
}

model DescribeAclResourceNameResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeAclResourceNameResponseBody(name='body'),
}

/**
 * @summary 查询acl资源名
 *
 * @param request DescribeAclResourceNameRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeAclResourceNameResponse
 */
async function describeAclResourceNameWithOptions(request: DescribeAclResourceNameRequest, runtime: Util.RuntimeOptions): DescribeAclResourceNameResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.aclResourcePatternType)) {
    query['AclResourcePatternType'] = request.aclResourcePatternType;
  }
  if (!Util.isUnset(request.aclResourceType)) {
    query['AclResourceType'] = request.aclResourceType;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeAclResourceName',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询acl资源名
 *
 * @param request DescribeAclResourceNameRequest
 * @return DescribeAclResourceNameResponse
 */
async function describeAclResourceName(request: DescribeAclResourceNameRequest): DescribeAclResourceNameResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeAclResourceNameWithOptions(request, runtime);
}

model DescribeAclsRequest {
  aclOperationType?: string(name='AclOperationType', description='The types of operations allowed by the ACL. Separate multiple operation types with commas (,).
- Valid values:
- Write
- Read
- Describe: reads of transactional IDs.
- IdempotentWrite: idempotent data writes to clusters.
- IDEMPOTENT_WRITE: idempotent data writes to clusters. This value is available only for ApsaraMQ for Kafka V3 instances.
- DESCRIBE_CONFIGS: queries of configurations. This value is available only for ApsaraMQ for Kafka V3 instances.
> This parameter is available only for ApsaraMQ for Kafka V3 serverless instances.', example='Write'),
  aclPermissionType?: string(name='AclPermissionType', description='The authorization method. Valid values:
- DENY
- ALLOW
> This parameter is available only for ApsaraMQ for Kafka V3 serverless instances.', example='DENY'),
  aclResourceName?: string(name='AclResourceName', description='The resource name.

*   The value can be the name of a topic or consumer group.
*   You can use an asterisk (\\\\*) to specify the names of all topics or consumer groups.

> You can query the resources on which permissions are granted only after you grant the user the required permissions on all resources.

This parameter is required.', example='demo'),
  aclResourcePatternType?: string(name='AclResourcePatternType', description='The match mode. Valid values:

*   LITERAL: full-name match
*   PREFIXED: prefix match', example='LITERAL'),
  aclResourceType?: string(name='AclResourceType', description='The resource type. Valid values:

*   **Topic**
*   **Group**

This parameter is required.', example='Topic'),
  host?: string(name='Host', description='The source IP address.
>-  You can specify only a specific IP address or use the asterisk (*) wildcard character to specify all IP addresses. CIDR blocks are not supported.
> - This parameter is available only for ApsaraMQ for Kafka V3 serverless instances.', example='*'),
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_pre-cn-v0h1cng****'),
  regionId?: string(name='RegionId', description='The ID of the region.

This parameter is required.', example='cn-hangzhou'),
  username?: string(name='Username', description='The username.

*   You can use an asterisk (\\\\*) to specify all users.

> You can use an asterisk (\\\\*) to query the authorized users only after you grant the required permissions to all users.

This parameter is required.', example='test12****'),
}

model DescribeAclsResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  kafkaAclList?: {
    kafkaAclVO?: [ 
    {
      aclOperationType?: string(name='AclOperationType', description='The types of operations allowed by the ACL. Separate multiple operation types with commas (,).
- Valid values:
- Write
- Read
- Describe: reads of transactional IDs.
- IdempotentWrite: idempotent data writes to clusters.
- IDEMPOTENT_WRITE: idempotent data writes to clusters. This value is available only for ApsaraMQ for Kafka V3 instances.
- DESCRIBE_CONFIGS: queries of configurations. This value is available only for ApsaraMQ for Kafka V3 instances.
> This parameter is available only for ApsaraMQ for Kafka V3 serverless instances.', example='Write'),
      aclPermissionType?: string(name='AclPermissionType', description='The authorization method. Valid values:
- DENY
- ALLOW
> This parameter is available only for ApsaraMQ for Kafka V3 serverless instances.', example='DENY'),
      aclResourceName?: string(name='AclResourceName', description='The resource name.

*   The value can be the name of a topic or consumer group.
*   You can use the asterisk (\\\\*) wildcard character to specify the names of all topics or consumer groups.', example='demo'),
      aclResourcePatternType?: string(name='AclResourcePatternType', description='The matching mode. Valid values:

*   **LITERAL:** full-name match
*   **PREFIXED**: prefix match', example='LITERAL'),
      aclResourceType?: string(name='AclResourceType', description='The resource type. Valid values:

*   **Topic**
*   **Group**', example='Topic'),
      host?: string(name='Host', description='The host.', example='****'),
      username?: string(name='Username', description='The username.', example='test12***'),
    }
  ](name='KafkaAclVO')
  }(name='KafkaAclList', description='The access control lists (ACLs).'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='46496E38-881E-4719-A2F3-F3DA6AE****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model DescribeAclsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeAclsResponseBody(name='body'),
}

/**
 * @summary Queries access control lists (ACLs).
 *
 * @param request DescribeAclsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeAclsResponse
 */
async function describeAclsWithOptions(request: DescribeAclsRequest, runtime: Util.RuntimeOptions): DescribeAclsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.aclOperationType)) {
    query['AclOperationType'] = request.aclOperationType;
  }
  if (!Util.isUnset(request.aclPermissionType)) {
    query['AclPermissionType'] = request.aclPermissionType;
  }
  if (!Util.isUnset(request.aclResourceName)) {
    query['AclResourceName'] = request.aclResourceName;
  }
  if (!Util.isUnset(request.aclResourcePatternType)) {
    query['AclResourcePatternType'] = request.aclResourcePatternType;
  }
  if (!Util.isUnset(request.aclResourceType)) {
    query['AclResourceType'] = request.aclResourceType;
  }
  if (!Util.isUnset(request.host)) {
    query['Host'] = request.host;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.username)) {
    query['Username'] = request.username;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeAcls',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries access control lists (ACLs).
 *
 * @param request DescribeAclsRequest
 * @return DescribeAclsResponse
 */
async function describeAcls(request: DescribeAclsRequest): DescribeAclsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeAclsWithOptions(request, runtime);
}

model DescribeSaslUsersRequest {
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_pre-cn-v0h1cng0****'),
  regionId?: string(name='RegionId', description='The ID of the region.

This parameter is required.', example='cn-hangzhou'),
}

model DescribeSaslUsersResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='9E3B3592-5994-4F65-A61E-E62A77A****'),
  saslUserList?: {
    saslUserVO?: [ 
    {
      mechanism?: string(name='Mechanism', description='The encryption method.

>  This parameter is available only for serverless ApsaraMQ for Kafka instances.', example='SCRAM-SHA-256'),
      password?: string(name='Password', description='The password.', example='******'),
      type?: string(name='Type', description='The type of the SASL user. Valid values:

*   **plain**: a simple mechanism that uses usernames and passwords to verify user identities. ApsaraMQ for Kafka provides an improved PLAIN mechanism that allows you to dynamically add SASL users without the need to restart an instance.
*   **SCRAM**: a mechanism that uses usernames and passwords to verify user identities. Compared with the PLAIN mechanism, this mechanism provides better security protection. ApsaraMQ for Kafka uses the SCRAM-SHA-256 algorithm.
*   **LDAP**: This value is available only for the SASL users of ApsaraMQ for Confluent instances.

Default value: **plain**.', example='scram'),
      username?: string(name='Username', description='The username.', example='test12***'),
    }
  ](name='SaslUserVO')
  }(name='SaslUserList', description='The Simple Authentication and Security Layer (SASL) users.'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model DescribeSaslUsersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSaslUsersResponseBody(name='body'),
}

/**
 * @summary Queries Simple Authentication and Security Layer (SASL) users.
 *
 * @param request DescribeSaslUsersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSaslUsersResponse
 */
async function describeSaslUsersWithOptions(request: DescribeSaslUsersRequest, runtime: Util.RuntimeOptions): DescribeSaslUsersResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSaslUsers',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries Simple Authentication and Security Layer (SASL) users.
 *
 * @param request DescribeSaslUsersRequest
 * @return DescribeSaslUsersResponse
 */
async function describeSaslUsers(request: DescribeSaslUsersRequest): DescribeSaslUsersResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeSaslUsersWithOptions(request, runtime);
}

model EnableAutoGroupCreationRequest {
  enable?: boolean(name='Enable', description='Specify whether to enable the flexible group creation feature. Valid values:

*   **true**: enables the flexible group creation feature.
*   **false**: disabled the flexible group creation feature.

This parameter is required.', example='true'),
  instanceId?: string(name='InstanceId', description='The instance ID.

You can call the [GetInstanceList](https://help.aliyun.com/document_detail/437663.html) operation to query instances.

This parameter is required.', example='alikafka_post-cn-mp919o4v****'),
  regionId?: string(name='RegionId', description='The region ID.

This parameter is required.', example='cn-hangzhou'),
}

model EnableAutoGroupCreationResponseBody = {
  code?: int32(name='Code', description='The returned HTTP status code.

If the value **200** is returned, the request is successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success'),
  requestId?: string(name='RequestId', description='The request ID.', example='A421CCD7-5BC5-4B32-8DD8-64668A8FCB56'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model EnableAutoGroupCreationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EnableAutoGroupCreationResponseBody(name='body'),
}

/**
 * @summary Enables and disables the flexible group creation feature.
 *
 * @param request EnableAutoGroupCreationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return EnableAutoGroupCreationResponse
 */
async function enableAutoGroupCreationWithOptions(request: EnableAutoGroupCreationRequest, runtime: Util.RuntimeOptions): EnableAutoGroupCreationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.enable)) {
    query['Enable'] = request.enable;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'EnableAutoGroupCreation',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Enables and disables the flexible group creation feature.
 *
 * @param request EnableAutoGroupCreationRequest
 * @return EnableAutoGroupCreationResponse
 */
async function enableAutoGroupCreation(request: EnableAutoGroupCreationRequest): EnableAutoGroupCreationResponse {
  var runtime = new Util.RuntimeOptions{};
  return enableAutoGroupCreationWithOptions(request, runtime);
}

model EnableAutoTopicCreationRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_post-cn-v0h1fgs2****'),
  operate?: string(name='Operate', description='The operation that you want to perform. Valid values:

*   enable: enables the automatic topic creation feature.
*   disable: disables the automatic topic creation feature.
*   updatePartition: changes the number of partitions in topics that are automatically created.', example='enable'),
  partitionNum?: long(name='PartitionNum', description='The changed number of partitions in topics that are automatically created.

This parameter takes effect only if you set Operate to updatePartition.', example='12'),
  regionId?: string(name='RegionId', description='The region ID.

This parameter is required.', example='cn-hangzhou'),
  updatePartition?: boolean(name='UpdatePartition'),
}

model EnableAutoTopicCreationResponseBody = {
  code?: int32(name='Code', description='The returned status code. If the request is successful, 200 is returned.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The request ID.', example='9E3B3592-5994-4F65-A61E-E62A77A7***'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model EnableAutoTopicCreationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EnableAutoTopicCreationResponseBody(name='body'),
}

/**
 * @summary Enables or disables the automatic topic creation feature, or changes the number of partitions in topics that are automatically created.
 *
 * @param request EnableAutoTopicCreationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return EnableAutoTopicCreationResponse
 */
async function enableAutoTopicCreationWithOptions(request: EnableAutoTopicCreationRequest, runtime: Util.RuntimeOptions): EnableAutoTopicCreationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.operate)) {
    query['Operate'] = request.operate;
  }
  if (!Util.isUnset(request.partitionNum)) {
    query['PartitionNum'] = request.partitionNum;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.updatePartition)) {
    query['UpdatePartition'] = request.updatePartition;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'EnableAutoTopicCreation',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Enables or disables the automatic topic creation feature, or changes the number of partitions in topics that are automatically created.
 *
 * @param request EnableAutoTopicCreationRequest
 * @return EnableAutoTopicCreationResponse
 */
async function enableAutoTopicCreation(request: EnableAutoTopicCreationRequest): EnableAutoTopicCreationResponse {
  var runtime = new Util.RuntimeOptions{};
  return enableAutoTopicCreationWithOptions(request, runtime);
}

model GetAllInstanceIdListRequest {
  regionId?: string(name='RegionId', description='The region ID of the instance. This parameter is reserved.', example='cn-hangzhou'),
}

model GetAllInstanceIdListResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  instanceIds?: map[string]any(name='InstanceIds', description='The IDs of instances that are managed by the Alibaba Cloud account in all the regions.', example='[{"cn-shenzhen": ["alikafka_post-cn-7pp2btvo****"],"us-west-1": ["alikafka_pre-cn-i7m2lxid****"],"cn-hangzhou": ["alikafka_pre-cn-i7m2hflj****","alikafka_pre-cn-zvp2hsje****","alikafka_pre-cn-zvp2kvc9****"]}]'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='ABA4A7FD-E10F-45C7-9774-A5236015****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model GetAllInstanceIdListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAllInstanceIdListResponseBody(name='body'),
}

/**
 * @summary Queries the IDs of all instances in the current account.
 *
 * @param request GetAllInstanceIdListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAllInstanceIdListResponse
 */
async function getAllInstanceIdListWithOptions(request: GetAllInstanceIdListRequest, runtime: Util.RuntimeOptions): GetAllInstanceIdListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAllInstanceIdList',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the IDs of all instances in the current account.
 *
 * @param request GetAllInstanceIdListRequest
 * @return GetAllInstanceIdListResponse
 */
async function getAllInstanceIdList(request: GetAllInstanceIdListRequest): GetAllInstanceIdListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAllInstanceIdListWithOptions(request, runtime);
}

model GetAllowedIpListRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_post-cn-mp91inkw****'),
  regionId?: string(name='RegionId', description='The region ID.

This parameter is required.', example='cn-hangzhou'),
}

model GetAllowedIpListResponseBody = {
  allowedList?: {
    deployType?: int32(name='DeployType', description='The deployment mode of the instance. Valid values:

*   **4**: allows access from the Internet and a virtual private cloud (VPC).
*   **5**: allows access from a VPC.

>  Only integrators need to concern themselves with the value of this parameter.', example='4'),
    internetList?: [ 
      {
        allowedIpGroup?: map[string]string(name='AllowedIpGroup', description='The group to which the IP address whitelist belongs.'),
        allowedIpList?: [ string ](name='AllowedIpList', description='The information about the IP address whitelist.'),
        blackIPList?: [ string ](name='BlackIPList'),
        blackIPMap?: map[string]string(name='BlackIPMap'),
        portRange?: string(name='PortRange', description='The port range. Valid value:

**9093/9093**.', example='9093/9093'),
        securityGroupId?: string(name='SecurityGroupId'),
        userDefinedSharedSecurityGroup?: boolean(name='UserDefinedSharedSecurityGroup'),
      }
    ](name='InternetList', description='The whitelist for access from the Internet.'),
    vpcList?: [ 
      {
        allowedIpGroup?: map[string]string(name='AllowedIpGroup', description='The group to which the IP address whitelist belongs.'),
        allowedIpList?: [ string ](name='AllowedIpList', description='The information about the IP address whitelist.'),
        blackIPList?: [ string ](name='BlackIPList'),
        blackIPMap?: map[string]string(name='BlackIPMap'),
        portRange?: string(name='PortRange', description='The port range. Valid value:

**9092/9092**.', example='9092/9092'),
        securityGroupId?: string(name='SecurityGroupId'),
        userDefinedSharedSecurityGroup?: boolean(name='UserDefinedSharedSecurityGroup'),
      }
    ](name='VpcList', description='The whitelist for access from a virtual private cloud (VPC).'),
  }(name='AllowedList', description='The IP address whitelist.'),
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The message returned.', example='operation success.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='A421CCD7-5BC5-4B32-8DD8-64668A8FCB56'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model GetAllowedIpListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAllowedIpListResponseBody(name='body'),
}

/**
 * @summary Queries the IP address whitelist.
 *
 * @param request GetAllowedIpListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAllowedIpListResponse
 */
async function getAllowedIpListWithOptions(request: GetAllowedIpListRequest, runtime: Util.RuntimeOptions): GetAllowedIpListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAllowedIpList',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the IP address whitelist.
 *
 * @param request GetAllowedIpListRequest
 * @return GetAllowedIpListResponse
 */
async function getAllowedIpList(request: GetAllowedIpListRequest): GetAllowedIpListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAllowedIpListWithOptions(request, runtime);
}

model GetAutoScalingConfigurationRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_serverless-cn-vxxxxxxxx'),
  regionId?: string(name='RegionId', description='The ID of the region where the instance resides.

This parameter is required.', example='cn-hangzhou'),
}

model GetAutoScalingConfigurationResponseBody = {
  code?: long(name='Code', description='The response code. The value 200 indicates that the request was successful.', example='200'),
  data?: {
    scheduledScalingRules?: {
      scheduledScalingRules?: [ 
      {
        durationMinutes?: long(name='DurationMinutes', description='The duration of a scheduled scaling task. Unit: minutes.', example='60'),
        enable?: boolean(name='Enable', description='Indicates whether the scheduled scaling rule is enabled. Valid values:

*   **true**
*   **false**', example='true'),
        estimatedElasticScalingDownTimeSecs?: long(name='EstimatedElasticScalingDownTimeSecs', description='The estimated scale-in duration. Unit: seconds.', example='780'),
        estimatedElasticScalingUpTimeSecs?: long(name='EstimatedElasticScalingUpTimeSecs', description='The estimated scale-out duration. Unit: seconds.', example='780'),
        firstScheduledTime?: long(name='FirstScheduledTime', description='The timestamp that indicates the start time of the scheduled scaling task.', example='1714467540000'),
        repeatType?: string(name='RepeatType', description='The frequency at which the scheduled scaling task is executed. This parameter is returned only if ScheduleType is set to repeat. Valid values:

*   Daily: The scheduled scaling task is executed every day.

*   Weekly: The scheduled scaling task is executed every week.', example='Weekly'),
        reservedPubFlow?: long(name='ReservedPubFlow', description='The reserved production capacity for scheduled scaling. Unit: MB/s.', example='120'),
        reservedSubFlow?: long(name='ReservedSubFlow', description='The reserved consumption capacity for scheduled scaling. Unit: MB/s.', example='120'),
        ruleId?: long(name='RuleId', description='The ID of the scheduled scaling rule.', example='64'),
        ruleName?: string(name='RuleName', description='The name of the scheduled scaling rule.', example='test'),
        scheduleType?: string(name='ScheduleType', description='The type of the scheduled scaling task. Valid values:

*   at: The scheduled scaling task is executed only once.
*   repeat: The scheduled scaling task is repeatedly executed.', example='at'),
        timeZone?: string(name='TimeZone', description='The time zone in Coordinated Universal Time (UTC).', example='GMT+8'),
        weeklyTypes?: {
          weeklyTypes?: [ string ](name='WeeklyTypes')
        }(name='WeeklyTypes', description='The day on which the scheduled scaling task is repeatedly executed. You can specify multiple days for this parameter.'),
      }
    ](name='ScheduledScalingRules')
    }(name='ScheduledScalingRules', description='The scheduled scaling rules.'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The request ID.', example='B7A39AE5-0B36-4442-A304-E0885265***'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='true'),
}

model GetAutoScalingConfigurationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetAutoScalingConfigurationResponseBody(name='body'),
}

/**
 * @summary Queries the scheduled scaling policy of a serverless ApsaraMQ for Kafka instance after you deploy the instance.
 *
 * @description ###### [](#-serverless-)**This operation is available only for serverless ApsaraMQ for Kafka instances.
 *
 * @param request GetAutoScalingConfigurationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetAutoScalingConfigurationResponse
 */
async function getAutoScalingConfigurationWithOptions(request: GetAutoScalingConfigurationRequest, runtime: Util.RuntimeOptions): GetAutoScalingConfigurationResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAutoScalingConfiguration',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the scheduled scaling policy of a serverless ApsaraMQ for Kafka instance after you deploy the instance.
 *
 * @description ###### [](#-serverless-)**This operation is available only for serverless ApsaraMQ for Kafka instances.
 *
 * @param request GetAutoScalingConfigurationRequest
 * @return GetAutoScalingConfigurationResponse
 */
async function getAutoScalingConfiguration(request: GetAutoScalingConfigurationRequest): GetAutoScalingConfigurationResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAutoScalingConfigurationWithOptions(request, runtime);
}

model GetConsumerListRequest {
  consumerId?: string(name='ConsumerId', description='The name of the consumer group. If you do not configure this parameter, all consumer groups are queried.', example='kafka-test'),
  currentPage?: int32(name='CurrentPage', description='The page number.', example='1'),
  instanceId?: string(name='InstanceId', description='The ID of the instance to which the consumer group belongs.

This parameter is required.', example='alikafka_post-cn-v0h18sav****'),
  pageSize?: int32(name='PageSize', description='The number of entries to be returned per page.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the instance to which the consumer group belongs.

This parameter is required.', example='cn-hangzhou'),
}

model GetConsumerListResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  consumerList?: {
    consumerVO?: [ 
    {
      automaticallyCreatedGroup?: boolean(name='AutomaticallyCreatedGroup', description='Indicates that the consumer group was automatically created by the system.', example='false'),
      consumerId?: string(name='ConsumerId', description='The consumer group ID.', example='kafka-test'),
      createTime?: long(name='CreateTime', description='The timestamp that indicates when the consumer group was created. Unit: milliseconds.', example='1729736584002'),
      instanceId?: string(name='InstanceId', description='The instance ID.', example='alikafka_post-cn-v0h18sav****'),
      regionId?: string(name='RegionId', description='The ID of the region where the instance resides.', example='cn-hangzhou'),
      remark?: string(name='Remark', description='The instance description.', example='test'),
      tags?: {
        tagVO?: [ 
        {
          key?: string(name='Key', description='The tag key.', example='test'),
          value?: string(name='Value', description='The tag value.', example='test'),
        }
      ](name='TagVO')
      }(name='Tags', description='The tags.'),
    }
  ](name='ConsumerVO')
  }(name='ConsumerList', description='The consumer groups.'),
  currentPage?: int32(name='CurrentPage', description='The number of the page to return. Pages start from page 1.', example='1'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  pageSize?: int32(name='PageSize', description='The number of entries returned per page.', example='10'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='808F042B-CB9A-4FBC-9009-00E7DDB6****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
  total?: long(name='Total', description='The total number of entries returned.', example='12'),
}

model GetConsumerListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetConsumerListResponseBody(name='body'),
}

/**
 * @summary Queries one or more consumer groups in a specified Message Queue for Apache Kafka instance.
 *
 * @param request GetConsumerListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetConsumerListResponse
 */
async function getConsumerListWithOptions(request: GetConsumerListRequest, runtime: Util.RuntimeOptions): GetConsumerListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.consumerId)) {
    query['ConsumerId'] = request.consumerId;
  }
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetConsumerList',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries one or more consumer groups in a specified Message Queue for Apache Kafka instance.
 *
 * @param request GetConsumerListRequest
 * @return GetConsumerListResponse
 */
async function getConsumerList(request: GetConsumerListRequest): GetConsumerListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getConsumerListWithOptions(request, runtime);
}

model GetConsumerProgressRequest {
  consumerId?: string(name='ConsumerId', description='The name of the consumer group.

This parameter is required.', example='kafka-test'),
  hideLastTimestamp?: boolean(name='HideLastTimestamp', description='Specifies whether to hide LastTimestamp. Default value: false. We recommend that you set this parameter to true.

> 

*   If you set this parameter to true, -1 is returned for LastTimestamp. If you set this parameter to false, a specific value is returned for LastTimestamp. This parameter is supported only by topics that use cloud storage on reserved instances.

*   A large amount of data is processed by this operation, which causes performance loss. We recommend that you set this parameter to true to accelerate processing.', example='true'),
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_pre-cn-mp919o4v****'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
}

model GetConsumerProgressResponseBody = {
  code?: int32(name='Code', description='The returned HTTP status code. If the request is successful, 200 is returned.', example='200'),
  consumerProgress?: {
    lastTimestamp?: long(name='LastTimestamp', description='The time when the last message consumed by the consumer group was generated.', example='1566874931671'),
    rebalanceInfoList?: {
      rebalanceInfoList?: [ 
      {
        generation?: long(name='Generation', description='The number of rebalances.', example='100'),
        groupId?: string(name='GroupId', description='The group ID of the subscriber.', example='falcon-uat'),
        lastRebalanceTimestamp?: long(name='LastRebalanceTimestamp', description='The time when the last rebalance occurred. Unit: milliseconds.', example='1709199270'),
        reason?: string(name='Reason', description='The cause of the rebalance.', example='removing member consumer-1-cd14eb9c-379b-4b8e-9bbd-76f147f8536f on LeaveGroup'),
        rebalanceSuccess?: boolean(name='RebalanceSuccess', description='Indicates whether new members are added to the consumer group in the rebalance.', example='true'),
        rebalanceTimeConsuming?: long(name='RebalanceTimeConsuming', description='The duration of the rebalance. Unit: milliseconds.', example='1'),
      }
    ](name='RebalanceInfoList')
    }(name='RebalanceInfoList', description='The details of rebalances in the consumer group.'),
    topicList?: {
      topicList?: [ 
      {
        lastTimestamp?: long(name='LastTimestamp', description='The time when the last consumed message in the topic was generated.', example='1566874931649'),
        offsetList?: {
          offsetList?: [ 
          {
            brokerOffset?: long(name='BrokerOffset', description='The latest offset in the partition of the topic.', example='9'),
            clientId?: string(name='ClientId', description='Client ID of the application.', example='client-id-KafkaConsumerDemo'),
            clientIp?: string(name='ClientIp', description='The IP address of the client.', example='172.16.11.3'),
            consumerOffset?: long(name='ConsumerOffset', description='The consumer offset in the partition of the topic.', example='9'),
            lastTimestamp?: long(name='LastTimestamp', description='The time when the last consumed message in the partition was generated.', example='1566874931649'),
            memberId?: string(name='MemberId', description='Member ID.', example='client-id-KafkaConsumerDemo-70b64883-a911-4882-8084-598b958848b4'),
            partition?: int32(name='Partition', description='The partition ID.', example='0'),
          }
        ](name='OffsetList')
        }(name='OffsetList', description='The consumer offsets.'),
        topic?: string(name='Topic', description='The topic name.', example='kafka-test'),
        totalDiff?: long(name='TotalDiff', description='The number of unconsumed messages in the topic to which the consumer group subscribes.', example='0'),
      }
    ](name='TopicList')
    }(name='TopicList', description='The consumer progress of each topic to which the consumer group subscribes.'),
    totalDiff?: long(name='TotalDiff', description='The total number of unconsumed messages in all topics to which the consumer group subscribes.', example='0'),
    state?: string(name='state'),
  }(name='ConsumerProgress', description='The consumer progress of the consumer group.'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The request ID.', example='252820E1-A2E6-45F2-B4C9-1056B8CE****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model GetConsumerProgressResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetConsumerProgressResponseBody(name='body'),
}

/**
 * @summary Queries the consumer progress of a consumer group.
 *
 * @param request GetConsumerProgressRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetConsumerProgressResponse
 */
async function getConsumerProgressWithOptions(request: GetConsumerProgressRequest, runtime: Util.RuntimeOptions): GetConsumerProgressResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.consumerId)) {
    query['ConsumerId'] = request.consumerId;
  }
  if (!Util.isUnset(request.hideLastTimestamp)) {
    query['HideLastTimestamp'] = request.hideLastTimestamp;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetConsumerProgress',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the consumer progress of a consumer group.
 *
 * @param request GetConsumerProgressRequest
 * @return GetConsumerProgressResponse
 */
async function getConsumerProgress(request: GetConsumerProgressRequest): GetConsumerProgressResponse {
  var runtime = new Util.RuntimeOptions{};
  return getConsumerProgressWithOptions(request, runtime);
}

model GetInstanceListRequest {
  instanceId?: [ string ](name='InstanceId', description='The IDs of instances.', example='alikafka_post-cn-mp91gnw0p***'),
  orderId?: string(name='OrderId', description='The ID of the order. You can obtain the order ID on the [Orders](https://usercenter2-intl.aliyun.com/order/list?pageIndex=1\\\\&pageSize=20\\\\&spm=5176.12818093.top-nav.ditem-ord.36f016d0OQFmJa) page in Alibaba Cloud User Center.', example='6072673****'),
  regionId?: string(name='RegionId', description='The ID of the region where the instance resides.

This parameter is required.', example='cn-hangzhou'),
  resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group. You can obtain this ID on the Resource Group page in the Resource Management console.', example='rg-ac***********7q'),
  series?: string(name='Series', description='The instance version. You can use instance versions to filter different versions of instances. Valid values:

*   v2
*   v3
*   confluent', example='v3'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key.

*   If you leave this parameter empty, the keys of all tags are matched.
*   The tag key can be up to 128 characters in length. It cannot start with aliyun or acs: and cannot contain `http://` or `https://`.', example='test'),
      value?: string(name='Value', description='The tag value.

*   If you leave Key empty, you must also leave this parameter empty. If you leave this parameter empty, the values of all tags are matched.
*   The tag value can be up to 128 characters in length. It cannot start with aliyun or acs: and cannot contain `http://` or `https://`.', example='test'),
    }
  ](name='Tag', description='The tags.'),
}

model GetInstanceListResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the call is successful.', example='200'),
  instanceList?: {
    instanceVO?: [ 
    {
      allConfig?: string(name='AllConfig', description='The configurations of the deployed ApsaraMQ for Kafka instance.', example='{\\\\"enable.vpc_sasl_ssl\\\\":\\\\"false\\\\",\\\\"kafka.log.retention.hours\\\\":\\\\"66\\\\",\\\\"enable.acl\\\\":\\\\"false\\\\",\\\\"kafka.message.max.bytes\\\\":\\\\"6291456\\\\"}'),
      autoCreateGroupEnable?: boolean(name='AutoCreateGroupEnable', description='Indicates whether the flexible group creation feature is enabled.', example='true'),
      autoCreateTopicEnable?: boolean(name='AutoCreateTopicEnable', description='Indicates whether the automatic topic creation feature is enabled.', example='true'),
      backupZoneId?: string(name='BackupZoneId', description='The ID of the secondary zone.', example='cn-hangzhou-a'),
      confluentConfig?: {
        connectCU?: int32(name='ConnectCU', description='The number of CPU cores of Connect.', example='4'),
        connectReplica?: int32(name='ConnectReplica', description='The number of replicas of Connect.', example='2'),
        controlCenterCU?: int32(name='ControlCenterCU', description='The number of CPU cores of Control Center.', example='4'),
        controlCenterReplica?: int32(name='ControlCenterReplica', description='The number of replicas of Control Center.', example='1'),
        controlCenterStorage?: int32(name='ControlCenterStorage', description='The disk capacity of Control Center. Unit: GB.', example='300'),
        kafkaCU?: int32(name='KafkaCU', description='The number of CPU cores of the Kafka broker.', example='4'),
        kafkaReplica?: int32(name='KafkaReplica', description='The number of replicas of the Kafka broker.', example='3'),
        kafkaRestProxyCU?: int32(name='KafkaRestProxyCU', description='The number of CPU cores of Kafka Rest Proxy.', example='4'),
        kafkaRestProxyReplica?: int32(name='KafkaRestProxyReplica', description='The number of replicas of Kafka Rest Proxy.', example='2'),
        kafkaStorage?: int32(name='KafkaStorage', description='The disk capacity of the Kafka broker. Unit: GB.', example='800'),
        ksqlCU?: int32(name='KsqlCU', description='The number of CPU cores of ksqlDB.', example='2'),
        ksqlReplica?: int32(name='KsqlReplica', description='The number of replicas of ksqlDB.', example='2'),
        ksqlStorage?: int32(name='KsqlStorage', description='The disk capacity of ksqlDB. Unit: GB.', example='100'),
        schemaRegistryCU?: int32(name='SchemaRegistryCU', description='The number of CPU cores of Schema Registry.', example='4'),
        schemaRegistryReplica?: int32(name='SchemaRegistryReplica', description='The number of replicas of Schema Registry.', example='2'),
        zooKeeperCU?: int32(name='ZooKeeperCU', description='The number of CPU cores of ZooKeeper.', example='2'),
        zooKeeperReplica?: int32(name='ZooKeeperReplica', description='The number of replicas of ZooKeeper.', example='3'),
        zooKeeperStorage?: int32(name='ZooKeeperStorage', description='The disk capacity of ZooKeeper. Unit: GB.', example='100'),
      }(name='ConfluentConfig', description='The parameters that are returned for the ApsaraMQ for Confluent instance.'),
      createTime?: long(name='CreateTime', description='The time when the instance was created. Unit: milliseconds.', example='1577961819000'),
      defaultPartitionNum?: int32(name='DefaultPartitionNum', description='The number of partitions in a topic that is automatically created.', example='12'),
      deployType?: int32(name='DeployType', description='The type of the network in which the instance is deployed. Valid values:

*   **4**: Internet and VPC
*   **5**: VPC', example='5'),
      diskSize?: int32(name='DiskSize', description='The disk size. Unit: GB', example='3600'),
      diskType?: int32(name='DiskType', description='The disk type of the instance. Valid values:

*   **0**: ultra disk
*   **1**: standard SSD', example='1'),
      domainEndpoint?: string(name='DomainEndpoint', description='The default endpoint of the instance in domain name mode. ApsaraMQ for Kafka instances support endpoints in domain name mode and IP address mode.

*   Endpoints in domain name mode: An endpoint in this mode consists of the domain name of the instance and a port number. The format of an endpoint in this mode is `{Instance domain name}:{Port number}`.
*   Endpoints in IP address mode: An endpoint in this mode consists of the IP address of the broker and a port number. The format of an endpoint in this mode is `{Broker IP address}:{Port number}`.', example='alikafka-pre-cn-zv**********-1-vpc.alikafka.aliyuncs.com:9092,alikafka-pre-cn-zv**********-2-vpc.alikafka.aliyuncs.com:9092,alikafka-pre-cn-zv**********-3-vpc.alikafka.aliyuncs.com:9092'),
      eipMax?: int32(name='EipMax', description='The maximum Internet traffic in the instance.', example='20'),
      endPoint?: string(name='EndPoint', description='The default endpoint of the instance in IP address mode. ApsaraMQ for Kafka instances support endpoints in domain name mode and IP address mode.

*   Endpoints in domain name mode: An endpoint in this mode consists of the domain name of the instance and a port number. The format of an endpoint in this mode is `{Instance domain name}:{Port number}`.
*   Endpoints in IP address mode: An endpoint in this mode consists of the IP address of the broker and a port number. The format of an endpoint in this mode is `{Broker IP address}:{Port number}`.', example='192.168.XX.XX:9092,192.168.XX.XX:9092,192.168.XX.XX:9092'),
      expiredTime?: long(name='ExpiredTime', description='The time when the instance expires. Unit: milliseconds.', example='1893581018000'),
      instanceId?: string(name='InstanceId', description='The instance ID.', example='alikafka_pre-cn-mp919o4v****'),
      ioMax?: int32(name='IoMax', description='The maximum traffic in the instance.', example='20'),
      ioMaxRead?: int32(name='IoMaxRead', description='The maximum read traffic in the instance. Unit: Mbit/s.', example='1000'),
      ioMaxSpec?: string(name='IoMaxSpec', description='The traffic specification.', example='alikafka.hw.2xlarge'),
      ioMaxWrite?: int32(name='IoMaxWrite', description='The maximum write traffic. Unit: Mbit/s.', example='1000'),
      kmsKeyId?: string(name='KmsKeyId', description='The ID of the key that is used for disk encryption in the region where the instance is deployed.', example='0d24xxxx-da7b-4786-b981-9a164dxxxxxx'),
      msgRetain?: int32(name='MsgRetain', description='The retention period of messages in the instance. Unit: hours.', example='72'),
      name?: string(name='Name', description='The instance name.', example='alikafka_post-cn-mp91gnw0****'),
      paidType?: int32(name='PaidType', description='The billing method of the instance. Valid values:

*   **0**: the subscription billing method
*   **1**: the pay-as-you-go billing method
*   **3**: the pay-as-you-go billing method for serverless ApsaraMQ for Kafka V3 instances
*   **4**: the pay-as-you-go billing method for ApsaraMQ for Confluent instances', example='1'),
      regionId?: string(name='RegionId', description='The ID of the region where the instance resides.', example='cn-hangzhou'),
      reservedPublishCapacity?: int32(name='ReservedPublishCapacity', description='The traffic reserved for message publishing. Unit: MB/s.

>  This parameter is returned only if the instance is a serverless ApsaraMQ for Kafka V3 instance.', example='60'),
      reservedSubscribeCapacity?: int32(name='ReservedSubscribeCapacity', description='The traffic reserved for message subscription. Unit: MB/s.

>  This parameter is returned only if the instance is a serverless ApsaraMQ for Kafka V3 instance.', example='60'),
      resourceGroupId?: string(name='ResourceGroupId', description='The ID of the resource group.', example='rg-ac***********7q'),
      saslDomainEndpoint?: string(name='SaslDomainEndpoint', description='The Simple Authentication and Security Layer (SASL) endpoint of the instance in domain name mode. ApsaraMQ for Kafka instances support endpoints in domain name mode and IP address mode.

*   Endpoints in domain name mode: An endpoint in this mode consists of the domain name of the instance and a port number. The format of an endpoint in this mode is `{Instance domain name}:{Port number}`.
*   Endpoints in IP address mode: An endpoint in this mode consists of the IP address of the broker and a port number. The format of an endpoint in this mode is `{Broker IP address}:{Port number}`.', example='alikafka-pre-cn-zv**********-1-vpc.alikafka.aliyuncs.com:9094,alikafka-pre-cn-zv**********-2-vpc.alikafka.aliyuncs.com:9094,alikafka-pre-cn-zv**********-3-vpc.alikafka.aliyuncs.com:9094'),
      saslEndPoint?: string(name='SaslEndPoint', description='The Simple Authentication and Security Layer (SASL) endpoint of the instance in IP address mode. ApsaraMQ for Kafka instances support endpoints in domain name mode and IP address mode.

*   Endpoints in domain name mode: An endpoint in this mode consists of the domain name of the instance and a port number. The format of an endpoint in this mode is `{Instance domain name}:{Port number}`.
*   Endpoints in IP address mode: An endpoint in this mode consists of the IP address of the broker and a port number. The format of an endpoint in this mode is `{Broker IP address}:{Port number}`.', example='172.16.3.XX:9094,172.16.3.XX:9094,172.16.3.XX:9094'),
      securityGroup?: string(name='SecurityGroup', description='The security group to which the instance belongs.

*   If the instance is deployed in the ApsaraMQ for Kafka console or by calling the [StartInstance](https://help.aliyun.com/document_detail/157786.html) operation without a security group configured, no value is returned.
*   If the instance is deployed by calling the [StartInstance](https://help.aliyun.com/document_detail/157786.html) operation with a security group configured, the returned value is the configured security group.', example='sg-bp13wfx7kz9pkow****'),
      series?: string(name='Series', description='The instance version. Valid values: v2, v3, and confluent.', example='v3'),
      serviceStatus?: int32(name='ServiceStatus', description='>  This parameter is out of date. We recommend that you refer to the ViewInstanceStatusCode parameter.

The instance status. Valid values:

*   **0**: pending
*   **1**: preparing hardware resources
*   **2**: initializing
*   **3**: starting
*   **5**: running
*   **6**: migrating
*   **7**: ready for upgrade
*   **8**: upgrading
*   **9**: ready for change
*   **10**: released
*   **11**: changing
*   **15**: expired
*   **30**: scaling', example='5'),
      specType?: string(name='SpecType', description='The instance edition. Valid values:

*   **professional**: Professional Edition (High Write)
*   **professionalForHighRead**: Professional Edition (High Read)
*   **normal**: Standard Edition', example='professional'),
      sslDomainEndpoint?: string(name='SslDomainEndpoint', description='The SSL endpoint of the instance in domain name mode. ApsaraMQ for Kafka instances support endpoints in domain name mode and IP address mode.

*   Endpoints in domain name mode: An endpoint in this mode consists of the domain name of the instance and a port number. The format of an endpoint in this mode is `{Instance domain name}:{Port number}`.
*   Endpoints in IP address mode: An endpoint in this mode consists of the IP address of the broker and a port number. The format of an endpoint in this mode is `{Broker IP address}:{Port number}`.', example='alikafka-pre-cn-zv**********-1.alikafka.aliyuncs.com:9093,alikafka-pre-cn-zv**********-2.alikafka.aliyuncs.com:9093,alikafka-pre-cn-zv**********-3.alikafka.aliyuncs.com:9093'),
      sslEndPoint?: string(name='SslEndPoint', description='The Secure Sockets Layer (SSL) endpoint of the instance in IP address mode. ApsaraMQ for Kafka instances support endpoints in domain name mode and IP address mode.

*   Endpoints in domain name mode: An endpoint in this mode consists of the domain name of the instance and a port number. The format of an endpoint in this mode is `{Instance domain name}:{Port number}`.
*   Endpoints in IP address mode: An endpoint in this mode consists of the IP address of the broker and a port number. The format of an endpoint in this mode is `{Broker IP address}:{Port number}`.', example='192.0.XX.XX:9093,198.51.XX.XX:9093,203.0.XX.XX:9093'),
      standardZoneId?: string(name='StandardZoneId', description='The zone ID.', example='cn-hangzhou-k'),
      tags?: {
        tagVO?: [ 
        {
          key?: string(name='Key', description='The tag key.', example='test'),
          value?: string(name='Value', description='The tag value.', example='test'),
        }
      ](name='TagVO')
      }(name='Tags', description='The tags.'),
      topicNumLimit?: int32(name='TopicNumLimit', description='The maximum number of topics on the instance.', example='180'),
      upgradeServiceDetailInfo?: {
        current2OpenSourceVersion?: string(name='Current2OpenSourceVersion', description='The open source Apache Kafka version that corresponds to the instance.', example='2.2.0'),
      }(name='UpgradeServiceDetailInfo', description='The upgrade information about the instance.'),
      usedGroupCount?: int32(name='UsedGroupCount', description='The number of used groups.', example='10'),
      usedPartitionCount?: int32(name='UsedPartitionCount', description='The number of used partitions.', example='25'),
      usedTopicCount?: int32(name='UsedTopicCount', description='The number of used topics.', example='3'),
      vSwitchId?: string(name='VSwitchId', description='The ID of the vSwitch to which the instance belongs.', example='vsw-bp1fvuw0ljd7vzmo3****'),
      vSwitchIds?: {
        vSwitchIds?: [ string ](name='VSwitchIds')
      }(name='VSwitchIds', description='The vSwitch IDs.'),
      viewInstanceStatusCode?: int32(name='ViewInstanceStatusCode', description='The instance status. The valid values are consistent with the values displayed in the ApsaraMQ for Kafka console. This parameter is used in the new version of ApsaraMQ for Kafka.

Valid values:

*   **0**: pending
*   **1**: deploying
*   **2**: running
*   **3**: stopped
*   **4**: expiring
*   **5**: expired
*   **6**: released
*   **7**: upgrading
*   **8**: migrating
*   **21**: stopping
*   **22**: starting
*   **23**: releasing
*   **30**: auto scaling
*   **101**: deployment failed
*   **102**: upgrade failed
*   **103**: migration failed', example='2'),
      vpcId?: string(name='VpcId', description='The virtual private cloud (VPC) ID.', example='vpc-bp1ojac7bv448nifj****'),
      vpcSaslDomainEndpoint?: string(name='VpcSaslDomainEndpoint', description='The SSL endpoint of the instance in domain name mode. You can use the endpoint to access the instance only in virtual private clouds (VPCs). ApsaraMQ for Kafka instances support endpoints in domain name mode and IP address mode.

*   Endpoints in domain name mode: An endpoint in this mode consists of the domain name of the instance and a port number. The format of an endpoint in this mode is `{Instance domain name}:{Port number}`.
*   Endpoints in IP address mode: An endpoint in this mode consists of the IP address of the broker and a port number. The format of an endpoint in this mode is `{Broker IP address}:{Port number}`.', example='alikafka-post-cn-******-1-vpc.alikafka.aliyuncs.com:9095,alikafka-post-cn-******-2-vpc.alikafka.aliyuncs.com:9095,alikafka-post-cn-******-3-vpc.alikafka.aliyuncs.com:9095'),
      vpcSaslEndPoint?: string(name='VpcSaslEndPoint', description='The Secure Sockets Layer (SSL) endpoint of the instance in IP address mode. You can use the endpoint to access the instance only in virtual private clouds (VPCs). ApsaraMQ for Kafka instances support endpoints in domain name mode and IP address mode.

*   Endpoints in domain name mode: An endpoint in this mode consists of the domain name of the instance and a port number. The format of an endpoint in this mode is `{Instance domain name}:{Port number}`.
*   Endpoints in IP address mode: An endpoint in this mode consists of the IP address of the broker and a port number. The format of an endpoint in this mode is `{Broker IP address}:{Port number}`.', example='172.16.3.XX:9095,172.16.3.XX:9095,172.16.3.XX:9095'),
      zoneId?: string(name='ZoneId', description='The zone ID.', example='zonei'),
    }
  ](name='InstanceVO')
  }(name='InstanceList', description='The instances.'),
  message?: string(name='Message', description='The message returned.', example='operation success.'),
  requestId?: string(name='RequestId', description='The ID of the region.', example='4B6D821D-7F67-4CAA-9E13-A5A997C3****'),
  success?: boolean(name='Success', description='Indicates whether the call was successful.', example='true'),
}

model GetInstanceListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetInstanceListResponseBody(name='body'),
}

/**
 * @summary Queries the information about instances in a specified region.
 *
 * @param request GetInstanceListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetInstanceListResponse
 */
async function getInstanceListWithOptions(request: GetInstanceListRequest, runtime: Util.RuntimeOptions): GetInstanceListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.orderId)) {
    query['OrderId'] = request.orderId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceGroupId)) {
    query['ResourceGroupId'] = request.resourceGroupId;
  }
  if (!Util.isUnset(request.series)) {
    query['Series'] = request.series;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetInstanceList',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about instances in a specified region.
 *
 * @param request GetInstanceListRequest
 * @return GetInstanceListResponse
 */
async function getInstanceList(request: GetInstanceListRequest): GetInstanceListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getInstanceListWithOptions(request, runtime);
}

model GetKafkaClientIpRequest {
  endTime?: long(name='EndTime', description='The end of the time range to query.

This parameter is required.', example='1716343502000'),
  group?: string(name='Group', description='The ID of the consumer group.

>  This parameter is required only if you set Type to byGroup.', example='group_name'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_post-cn-v0h1fgs2****'),
  regionId?: string(name='RegionId', description='The ID of the region where the instance is deployed.

This parameter is required.', example='cn-hangzhou'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query.

This parameter is required.', example='1716343501000'),
  topic?: string(name='Topic', description='The topic name.

> 

*   This parameter is required only if you set Type to byTopic.', example='topic_name'),
  type?: string(name='Type', description='The query method that you want to use to query the client IP addresses. Valid values:

*   byInstance: queries the IP addresses of the clients that are connected to the instance within a specific period of time.
*   byTopic: queries the IP addresses of the clients that are connected to a specific topic on the instance within a specific period of time.
*   byGroup: queries the IP addresses of the clients that are connected to a specific group on the instance within a specific period of time.

This parameter is required.', example='byInstance'),
}

model GetKafkaClientIpResponseBody = {
  code?: long(name='Code', description='The returned status code. The status code 200 indicates that the request was successful.', example='200'),
  data?: {
    alert?: boolean(name='Alert', description='The value true indicates that the broker is not of the latest minor version.

>  If the broker is not of the latest minor version, the sampled logs may not be accurate. This may cause inaccurate IP information. Therefore, we recommend that you update your broker to the latest version at the earliest opportunity.', example='true'),
    data?: {
      data?: [ 
      {
        data?: {
          data?: [ 
          {
            ip?: string(name='Ip', description='The IP address of the client.', example='58.210.117.154'),
            num?: long(name='Num', description='The statistics.

>  The value of this parameter indicates the number of connections on different ports of the IP address within the specified period of time.', example='3'),
          }
        ](name='Data')
        }(name='Data', description='The response parameters.'),
        name?: string(name='Name', description='The request name.

>  The value of this parameter indicates the type of request that the client sends to the broker within the specified period of time.', example='OFFSET_COMMIT'),
      }
    ](name='Data')
    }(name='Data', description='The data returned.'),
    endDate?: long(name='EndDate', description='The end of the date range within which data is queried.', example='1716343502000'),
    searchTimeRange?: int32(name='SearchTimeRange', description='The time range within which the client IP addresses are queried.

>  The valid value is 1 hour. If the beginning of the time range to query and the end of the time range to query exceeds 1 hour, only data within 1 hour is returned.', example='1'),
    startDate?: long(name='StartDate', description='The beginning of the date range within which data is queried.', example='1716343501000'),
    timeLimitDay?: int32(name='TimeLimitDay', description='The date range within which the client IP addresses are queried.

>  The valid value is 7 days. If the beginning of the date range to query and the end of the date range to query exceeds 7 days, only data within 7 days is returned.', example='7'),
  }(name='Data', description='The data returned.'),
  message?: string(name='Message', description='The message returned.', example='operation success.'),
  requestId?: string(name='RequestId', description='The request ID.', example='E57A8862-DF68-4055-8E55-B80CB4****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='true'),
}

model GetKafkaClientIpResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetKafkaClientIpResponseBody(name='body'),
}

/**
 * @summary Queries the IP addresses of the clients that are connected to an ApsaraMQ for Kafka instance.
 *
 * @description *   The IP information is obtained from the sampled logs generated for the requests that the client sends to the broker by calling the API operations of ApsaraMQ for Kafka.
 * *   Statistics refers to the number of connections on different ports of an IP address within a specific period of time.
 * *   If the broker is not of the latest minor version, the sampled logs may not be accurate. This may cause inaccurate IP information. Therefore, we recommend that you update your broker to the latest version at the earliest opportunity.
 *
 * @param request GetKafkaClientIpRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetKafkaClientIpResponse
 */
async function getKafkaClientIpWithOptions(request: GetKafkaClientIpRequest, runtime: Util.RuntimeOptions): GetKafkaClientIpResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.group)) {
    query['Group'] = request.group;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!Util.isUnset(request.topic)) {
    query['Topic'] = request.topic;
  }
  if (!Util.isUnset(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetKafkaClientIp',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the IP addresses of the clients that are connected to an ApsaraMQ for Kafka instance.
 *
 * @description *   The IP information is obtained from the sampled logs generated for the requests that the client sends to the broker by calling the API operations of ApsaraMQ for Kafka.
 * *   Statistics refers to the number of connections on different ports of an IP address within a specific period of time.
 * *   If the broker is not of the latest minor version, the sampled logs may not be accurate. This may cause inaccurate IP information. Therefore, we recommend that you update your broker to the latest version at the earliest opportunity.
 *
 * @param request GetKafkaClientIpRequest
 * @return GetKafkaClientIpResponse
 */
async function getKafkaClientIp(request: GetKafkaClientIpRequest): GetKafkaClientIpResponse {
  var runtime = new Util.RuntimeOptions{};
  return getKafkaClientIpWithOptions(request, runtime);
}

model GetQuotaTipRequest {
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_pre-cn-i7m2wpm5****'),
  regionId?: string(name='RegionId', description='The ID of the region in which the instance resides.

This parameter is required.', example='cn-hangzhou'),
}

model GetQuotaTipResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The additional message. This message is typically used to describe API call failures for troubleshooting.', example='operation success.'),
  quotaData?: {
    groupLeft?: int32(name='GroupLeft', description='The number of available groups.', example='50'),
    groupUsed?: int32(name='GroupUsed', description='The number of used groups.', example='50'),
    isPartitionBuy?: int32(name='IsPartitionBuy', description='The method that you use to purchase partitions. Valid values:

*   0: indicates that the instance is purchased based on topics.
*   1: indicates that the instance is purchased based on partitions.', example='1'),
    partitionLeft?: int32(name='PartitionLeft', description='The number of available partitions.', example='1050'),
    partitionNumOfBuy?: int32(name='PartitionNumOfBuy', description='The number of purchased partitions.', example='100'),
    partitionQuota?: int32(name='PartitionQuota', description='The quota of partitions.', example='1100'),
    partitionUsed?: int32(name='PartitionUsed', description='The number of used partitions.', example='50'),
    topicLeft?: int32(name='TopicLeft', description='The number of available topics.', example='20'),
    topicNumOfBuy?: int32(name='TopicNumOfBuy', description='The number of purchased topics.', example='50'),
    topicQuota?: int32(name='TopicQuota', description='The quota of topics.', example='50'),
    topicUsed?: int32(name='TopicUsed', description='The number of used topics.', example='30'),
  }(name='QuotaData', description='The quota.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0178A3A7-E87B-5E50-A16F-3E62F534****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='True'),
}

model GetQuotaTipResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetQuotaTipResponseBody(name='body'),
}

/**
 * @summary Queries the used quota of topics and partitions.
 *
 * @param request GetQuotaTipRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetQuotaTipResponse
 */
async function getQuotaTipWithOptions(request: GetQuotaTipRequest, runtime: Util.RuntimeOptions): GetQuotaTipResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetQuotaTip',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the used quota of topics and partitions.
 *
 * @param request GetQuotaTipRequest
 * @return GetQuotaTipResponse
 */
async function getQuotaTip(request: GetQuotaTipRequest): GetQuotaTipResponse {
  var runtime = new Util.RuntimeOptions{};
  return getQuotaTipWithOptions(request, runtime);
}

model GetTopicListRequest {
  currentPage?: string(name='CurrentPage', description='The page number. Default value: 1', example='1'),
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_pre-cn-0pp1954n****'),
  pageSize?: string(name='PageSize', description='The number of entries to return on each page. Default value: 10.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the instance to which the topics that you want to query belong.', example='cn-hangzhou'),
  topic?: string(name='Topic', description='The name of the topic that you want to query.', example='topic_name'),
}

model GetTopicListResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  currentPage?: int32(name='CurrentPage', description='The page number of the returned page.', example='1'),
  message?: string(name='Message', description='The message returned.', example='operation success.'),
  pageSize?: int32(name='PageSize', description='The number of entries returned on each page.', example='10'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='C0D3DC5B-5C37-47AD-9F22-1F559880****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='true'),
  topicList?: {
    topicVO?: [ 
    {
      autoCreate?: boolean(name='AutoCreate', description='Indicates whether the topic was automatically created.', example='false'),
      compactTopic?: boolean(name='CompactTopic', description='The log cleanup policy for the topic. This parameter is returned only if **LocalTopic** is set to **true**. Valid values:

*   false: the default log cleanup policy.
*   true: the Apache Kafka log compaction policy.', example='false'),
      createTime?: long(name='CreateTime', description='The timestamp that indicates when the topic was created. Unit: milliseconds.', example='1576563109000'),
      instanceId?: string(name='InstanceId', description='The instance ID.', example='alikafka_pre-cn-0pp1954n****'),
      localTopic?: boolean(name='LocalTopic', description='The storage type that is used for the topic. Valid values:

*   false: cloud storage
*   true: local storage', example='false'),
      partitionNum?: int32(name='PartitionNum', description='The number of partitions in the topic.', example='6'),
      regionId?: string(name='RegionId', description='The ID of the region where the instance resides.', example='cn-hangzhou'),
      remark?: string(name='Remark', description='The topic description. Valid values:

*   The description can contain only letters, digits, hyphens (-), and underscores (_).
*   The description must be 3 to 64 characters in length.', example='test'),
      status?: int32(name='Status', description='The topic status. Valid value:

**0**: running.

If the topic is deleted, this parameter is not returned.', example='0'),
      statusName?: string(name='StatusName', description='The topic status. Valid value:

**Running**.

If the topic is deleted, this parameter is not returned.', example='Running'),
      tags?: {
        tagVO?: [ 
        {
          key?: string(name='Key', description='The tag key.', example='Test'),
          value?: string(name='Value', description='The tag value.', example='Test'),
        }
      ](name='TagVO')
      }(name='Tags', description='The tags.'),
      topic?: string(name='Topic', description='The topic name. Valid values:

*   The name can contain only letters, digits, hyphens (-), and underscores (_).
*   The name must be 3 to 64 characters in length. If the name contains more than 64 characters, the system automatically truncates the name.', example='topic_name'),
      topicConfig?: string(name='TopicConfig', description='The topic configuration.', example='{"replication-factor":3}'),
    }
  ](name='TopicVO')
  }(name='TopicList', description='The topics.'),
  total?: int32(name='Total', description='The number of topics.', example='1'),
}

model GetTopicListResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTopicListResponseBody(name='body'),
}

/**
 * @summary Queries the information about a topic.
 *
 * @param request GetTopicListRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTopicListResponse
 */
async function getTopicListWithOptions(request: GetTopicListRequest, runtime: Util.RuntimeOptions): GetTopicListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.topic)) {
    query['Topic'] = request.topic;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTopicList',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about a topic.
 *
 * @param request GetTopicListRequest
 * @return GetTopicListResponse
 */
async function getTopicList(request: GetTopicListRequest): GetTopicListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTopicListWithOptions(request, runtime);
}

model GetTopicStatusRequest {
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_pre-cn-v0h15tjm****'),
  regionId?: string(name='RegionId', description='The region ID of the instance.', example='cn-hangzhou'),
  topic?: string(name='Topic', description='The name of the topic.

This parameter is required.', example='normal_topic_9d034262835916103455551be06cc****'),
}

model GetTopicStatusResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='E475C7E2-8C35-46EF-BE7D-5D2A9F5D****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
  topicStatus?: {
    lastTimeStamp?: long(name='LastTimeStamp', description='The time when the last consumed message was generated.', example='1566470063575'),
    offsetTable?: {
      offsetTable?: [ 
      {
        lastUpdateTimestamp?: long(name='LastUpdateTimestamp', description='The last time when the partition was modified.', example='1566470063547'),
        maxOffset?: long(name='MaxOffset', description='The latest offset in the partition of the topic.', example='76'),
        minOffset?: long(name='MinOffset', description='The earliest offset in the partition of the topic.', example='0'),
        partition?: int32(name='Partition', description='The ID of the partition.', example='0'),
        topic?: string(name='Topic', description='The name of the topic.', example='testkafka'),
      }
    ](name='OffsetTable')
    }(name='OffsetTable', description='The information about offsets in the topic.'),
    totalCount?: long(name='TotalCount', description='The number of messages in the topic.', example='423'),
  }(name='TopicStatus', description='The status information about messages in the topic.'),
}

model GetTopicStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTopicStatusResponseBody(name='body'),
}

/**
 * @summary Queries the messaging status of a topic.
 *
 * @param request GetTopicStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTopicStatusResponse
 */
async function getTopicStatusWithOptions(request: GetTopicStatusRequest, runtime: Util.RuntimeOptions): GetTopicStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.topic)) {
    query['Topic'] = request.topic;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTopicStatus',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the messaging status of a topic.
 *
 * @param request GetTopicStatusRequest
 * @return GetTopicStatusResponse
 */
async function getTopicStatus(request: GetTopicStatusRequest): GetTopicStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTopicStatusWithOptions(request, runtime);
}

model GetTopicSubscribeStatusRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

You can call the [GetInstanceList](https://help.aliyun.com/document_detail/437663.html) operation to query the list of instances.

This parameter is required.', example='alikafka_pre-cn-v0h1cng0***'),
  regionId?: string(name='RegionId', description='The region ID.

This parameter is required.', example='cn-hangzhou'),
  topic?: string(name='Topic', description='The topic name.

You can call the [GetTopicList](https://help.aliyun.com/document_detail/437677.html) operation to query the list of topics.

This parameter is required.', example='topic_name'),
}

model GetTopicSubscribeStatusResponseBody = {
  code?: int32(name='Code', description='The HTTP status code.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success'),
  requestId?: string(name='RequestId', description='The request ID.', example='06084011-E093-46F3-A51F-4B19A8AD****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
  topicSubscribeStatus?: {
    consumerGroups?: [ string ](name='ConsumerGroups', description='The groups that subscribe to the topic.'),
    topic?: string(name='Topic', description='The topic name.', example='topic_api_1681624879908'),
  }(name='TopicSubscribeStatus', description='The subscription details.'),
}

model GetTopicSubscribeStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTopicSubscribeStatusResponseBody(name='body'),
}

/**
 * @summary Queries the information about the groups that subscribe to a topic.
 *
 * @param request GetTopicSubscribeStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTopicSubscribeStatusResponse
 */
async function getTopicSubscribeStatusWithOptions(request: GetTopicSubscribeStatusRequest, runtime: Util.RuntimeOptions): GetTopicSubscribeStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.topic)) {
    query['Topic'] = request.topic;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTopicSubscribeStatus',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about the groups that subscribe to a topic.
 *
 * @param request GetTopicSubscribeStatusRequest
 * @return GetTopicSubscribeStatusResponse
 */
async function getTopicSubscribeStatus(request: GetTopicSubscribeStatusRequest): GetTopicSubscribeStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTopicSubscribeStatusWithOptions(request, runtime);
}

model ListTagResourcesRequest {
  nextToken?: string(name='NextToken', description='The token that determines the start point of the next query.', example='caeba0bbb2be03f84eb48b699f0a4883'),
  regionId?: string(name='RegionId', description='The ID of the region in which the resource is deployed.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: [ string ](name='ResourceId', description='The ID of the resource whose tags you want to query. The resource ID follows the following rules:

*   Instance ID: instanceId
*   Topic ID: Kafka_alikafka_instanceId_topic
*   Group ID: Kafka_alikafka_instanceId_consumerGroup

For example, if the instance ID is alikafka_post-cn-v0h1fgs2xxxx, the topic name is test-topic, and the group name is test-consumer-group, the resource IDs are alikafka_post-cn-v0h1fgs2xxxx, Kafka_alikafka_post-cn-v0h1fgs2xxxx_test-topic, and Kafka_alikafka_post-cn-v0h1fgs2xxxx_test-consumer-group, respectively.

>  You must configure one of **ResourceId** and **Tag** to query the tags that are bound to a resource. Otherwise, the request fails.', example='alikafka_post-cn-v0h1fgs2****'),
  resourceType?: string(name='ResourceType', description='The type of the resource whose tags you want to query. The value is an enumerated value. Valid values:

*   **INSTANCE**
*   **TOPIC**
*   **CONSUMERGROUP**

This parameter is required.', example='INSTANCE'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the resource tag.

*   If you leave this parameter empty, the keys of all tags are matched.
*   The tag key can be up to 128 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.', example='FinanceDept'),
      value?: string(name='Value', description='The value of the resource tag.

*   If you leave Key empty, you must also leave this parameter empty. If you leave this parameter empty, the values of all tags are matched.
*   The tag value can be up to 128 characters in length and cannot contain http:// or https://. The tag value cannot start with acs: or aliyun.', example='FinanceJoshua'),
    }
  ](name='Tag', description='The tags.'),
}

model ListTagResourcesResponseBody = {
  nextToken?: string(name='NextToken', description='The token that determines the start point of the next query.', example='caeba0bbb2be03f84eb48b699f0a4883'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='DE65F6B7-7566-4802-9007-96F2494A****'),
  tagResources?: {
    tagResource?: [ 
    {
      resourceId?: string(name='ResourceId', description='The ID of the resource. A resource ID complies with the following rules:

*   The resource ID of an instance is the value of the instanceId parameter.
*   The resource ID of a topic is the value of the Kafka_alikafka_instanceId_topic parameter.
*   The resource ID of a consumer group is the value of the Kafka_alikafka_instanceId_consumerGroup parameter.

For example, the resources whose tags you want to query include the alikafka_post-cn-v0h1fgs2xxxx instance, the test-topic topic, and the test-consumer-group consumer group. In this case, their resource IDs are alikafka_post-cn-v0h1fgs2xxxx, Kafka_alikafka_post-cn-v0h1fgs2xxxx_test-topic, and Kafka_alikafka_post-cn-v0h1fgs2xxxx_test-consumer-group.', example='alikafka_post-cn-v0h1fgs2****'),
      resourceType?: string(name='ResourceType', description='The type of the resource. The value is an enumerated value. Valid values:

*   **Instance**
*   **Topic**
*   **Consumergroup**', example='instance'),
      tagKey?: string(name='TagKey', description='The key of the tag.', example='FinanceDept'),
      tagValue?: string(name='TagValue', description='The value of the tag.', example='FinanceJoshua'),
    }
  ](name='TagResource')
  }(name='TagResources', description='Details of the resource and tags, such as the resource ID, the resource type, tag keys, and tag values.'),
}

model ListTagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagResourcesResponseBody(name='body'),
}

/**
 * @summary Queries the tags that are attached to a specified resource.
 *
 * @param request ListTagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagResourcesResponse
 */
async function listTagResourcesWithOptions(request: ListTagResourcesRequest, runtime: Util.RuntimeOptions): ListTagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTagResources',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the tags that are attached to a specified resource.
 *
 * @param request ListTagResourcesRequest
 * @return ListTagResourcesResponse
 */
async function listTagResources(request: ListTagResourcesRequest): ListTagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listTagResourcesWithOptions(request, runtime);
}

model ModifyInstanceNameRequest {
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_post-cn-v0h1fgs2****'),
  instanceName?: string(name='InstanceName', description='The instance name. Valid values:

*   The name can contain only letters, digits, hyphens (-), and underscores (_).
*   The name must be 3 to 64 characters in length. A name that contains more than 64 characters is automatically truncated.

This parameter is required.', example='dev-test'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
}

model ModifyInstanceNameResponseBody = {
  code?: int32(name='Code', description='The HTTP status code. The status code 200 indicates that the call is successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The request ID.', example='06084011-E093-46F3-A51F-4B19A8AD****'),
  success?: boolean(name='Success', description='Indicates whether the call is successful.', example='true'),
}

model ModifyInstanceNameResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyInstanceNameResponseBody(name='body'),
}

/**
 * @summary Changes the name of an ApsaraMQ for Kafka instance. After you deploy an instance, you can call this operation to change the name of the instance.
 *
 * @param request ModifyInstanceNameRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyInstanceNameResponse
 */
async function modifyInstanceNameWithOptions(request: ModifyInstanceNameRequest, runtime: Util.RuntimeOptions): ModifyInstanceNameResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyInstanceName',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the name of an ApsaraMQ for Kafka instance. After you deploy an instance, you can call this operation to change the name of the instance.
 *
 * @param request ModifyInstanceNameRequest
 * @return ModifyInstanceNameResponse
 */
async function modifyInstanceName(request: ModifyInstanceNameRequest): ModifyInstanceNameResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyInstanceNameWithOptions(request, runtime);
}

model ModifyPartitionNumRequest {
  addPartitionNum?: int32(name='AddPartitionNum', description='The number of partitions that you want to add to the topic.

*   The value must be an integer that is greater than 0.
*   To reduce the risk of data skew, we recommend that you set the value to a multiple of 6.
*   The number of total partitions ranges from 1 to 360.

This parameter is required.', example='6'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_post-cn-0pp1l9z****'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  topic?: string(name='Topic', description='The topic name.

This parameter is required.', example='TopicPartitionNum'),
}

model ModifyPartitionNumResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The message returned.', example='operation success'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='B7A39AE5-0B36-4442-A304-E088526****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model ModifyPartitionNumResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyPartitionNumResponseBody(name='body'),
}

/**
 * @summary Changes the number of partitions in a topic.
 *
 * @param request ModifyPartitionNumRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyPartitionNumResponse
 */
async function modifyPartitionNumWithOptions(request: ModifyPartitionNumRequest, runtime: Util.RuntimeOptions): ModifyPartitionNumResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.addPartitionNum)) {
    query['AddPartitionNum'] = request.addPartitionNum;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.topic)) {
    query['Topic'] = request.topic;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyPartitionNum',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the number of partitions in a topic.
 *
 * @param request ModifyPartitionNumRequest
 * @return ModifyPartitionNumResponse
 */
async function modifyPartitionNum(request: ModifyPartitionNumRequest): ModifyPartitionNumResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyPartitionNumWithOptions(request, runtime);
}

model ModifyScheduledScalingRuleRequest {
  enable?: boolean(name='Enable', description='Specifies whether to enable the scheduled scaling rule. Valid values:

*   **true**
*   **false**

>  If the scaling task is scheduled to execute only once and you want to enable the scheduled scaling rule, make sure that the value of this parameter is at least 30 minutes later than the current point in time.

This parameter is required.', example='true'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_serverless-cn-vxxxxxxxx'),
  regionId?: string(name='RegionId', description='The ID of the region where the instance resides.

This parameter is required.', example='cn-hangzhou'),
  ruleName?: string(name='RuleName', description='The name of the scheduled scaling rule.

This parameter is required.', example='contact-id'),
}

model ModifyScheduledScalingRuleResponseBody = {
  code?: long(name='Code', description='The response code.

The value **200** indicates that the request was successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The request ID.', example='DB6F1BEA-903B-4FD8-8809-46E7E9CE***'),
  success?: boolean(name='Success', description='Indicates whether the request was successful.', example='True'),
}

model ModifyScheduledScalingRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyScheduledScalingRuleResponseBody(name='body'),
}

/**
 * @summary Modifies the scheduled scaling policy of a serverless ApsaraMQ for Kafka instance after you deploy the instance.
 *
 * @description ###### [](#-serverless-)This operation is available only for serverless ApsaraMQ for Kafka instances.
 *
 * @param request ModifyScheduledScalingRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyScheduledScalingRuleResponse
 */
async function modifyScheduledScalingRuleWithOptions(request: ModifyScheduledScalingRuleRequest, runtime: Util.RuntimeOptions): ModifyScheduledScalingRuleResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.enable)) {
    query['Enable'] = request.enable;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.ruleName)) {
    query['RuleName'] = request.ruleName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyScheduledScalingRule',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the scheduled scaling policy of a serverless ApsaraMQ for Kafka instance after you deploy the instance.
 *
 * @description ###### [](#-serverless-)This operation is available only for serverless ApsaraMQ for Kafka instances.
 *
 * @param request ModifyScheduledScalingRuleRequest
 * @return ModifyScheduledScalingRuleResponse
 */
async function modifyScheduledScalingRule(request: ModifyScheduledScalingRuleRequest): ModifyScheduledScalingRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyScheduledScalingRuleWithOptions(request, runtime);
}

model ModifyTopicRemarkRequest {
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_post-cn-0pp1l9z****'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  remark?: string(name='Remark', description='The description of the topic.', example='testremark'),
  topic?: string(name='Topic', description='The name of the topic.

This parameter is required.', example='alikafka_post-cn-0pp1l9z8****'),
}

model ModifyTopicRemarkResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='DB6F1BEA-903B-4FD8-8809-46E7E9CE***'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model ModifyTopicRemarkResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyTopicRemarkResponseBody(name='body'),
}

/**
 * @summary Modifies the description of a topic.
 *
 * @param request ModifyTopicRemarkRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyTopicRemarkResponse
 */
async function modifyTopicRemarkWithOptions(request: ModifyTopicRemarkRequest, runtime: Util.RuntimeOptions): ModifyTopicRemarkResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!Util.isUnset(request.topic)) {
    query['Topic'] = request.topic;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyTopicRemark',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the description of a topic.
 *
 * @param request ModifyTopicRemarkRequest
 * @return ModifyTopicRemarkResponse
 */
async function modifyTopicRemark(request: ModifyTopicRemarkRequest): ModifyTopicRemarkResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyTopicRemarkWithOptions(request, runtime);
}

model QueryMessageRequest {
  beginTime?: long(name='BeginTime', description='The beginning of the time range to query. The value of this parameter is a UNIX timestamp in milliseconds.', example='1672410180000'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_pre-cn-mp919o4v****'),
  offset?: string(name='Offset', description='The consumer offset of the partition.', example='100'),
  partition?: string(name='Partition', description='The partition ID.', example='0'),
  queryType?: string(name='QueryType', description='The query type. Valid values:

*   byOffset: queries messages by offset. If you select this value, you must configure Partition and Offset.
*   byTimestamp: queries messages by time. If you select this value, you must configure BeginTime.

This parameter is required.', example='byTimestamp'),
  regionId?: string(name='RegionId', description='The ID of the region where the resource resides.

This parameter is required.', example='cn-hangzhou'),
  topic?: string(name='Topic', description='The topic name.

This parameter is required.', example='testkafka'),
}

model QueryMessageResponseBody = {
  code?: int32(name='Code', description='The returned HTTP status code. If the request is successful, 200 is returned.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  messageList?: [ 
    {
      checksum?: long(name='Checksum', description='The check value of the chaincode.', example='0'),
      key?: string(name='Key', description='The message key.', example='this is key'),
      keyTruncated?: boolean(name='KeyTruncated', description='Indicates whether the key is truncated.', example='false'),
      offset?: long(name='Offset', description='The consumer offset of the partition.', example='1'),
      partition?: long(name='Partition', description='The partition ID.', example='0'),
      serializedKeySize?: int32(name='SerializedKeySize', description='The size of the key after serialization. Unit: bytes.', example='11'),
      serializedValueSize?: int32(name='SerializedValueSize', description='The size of the value after serialization. Unit: bytes.', example='20'),
      timestamp?: long(name='Timestamp', description='The time when the message was created. The value of this parameter is a UNIX timestamp in milliseconds.', example='1705482172640'),
      timestampType?: string(name='TimestampType', description='The time type.', example='CreateTime'),
      topic?: string(name='Topic', description='The topic name.', example='dqc_test2'),
      truncatedKeySize?: int32(name='TruncatedKeySize', description='The truncated size of the message key. Unit: bytes.

>  A maximum of 1 KB of content can be displayed for each message. Content that exceeds 1 KB is automatically truncated. For more information, see [Query messages](https://help.aliyun.com/document_detail/113172.html).', example='0'),
      truncatedValueSize?: int32(name='TruncatedValueSize', description='The truncated size of the message value. Unit: bytes.

>  A maximum of 1 KB of content can be displayed for each message. Content that exceeds 1 KB is automatically truncated. For more information, see [Query messages](https://help.aliyun.com/document_detail/113172.html).', example='0'),
      value?: string(name='Value', description='The message value.', example='Welcome to Ali kafka'),
      valueTruncated?: boolean(name='ValueTruncated', description='Indicates whether the value is truncated.', example='false'),
    }
  ](name='MessageList', description='The messages.'),
  requestId?: string(name='RequestId', description='The request ID.', example='ABA4A7FD-E10F-45C7-9774-A5236015****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model QueryMessageResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryMessageResponseBody(name='body'),
}

/**
 * @summary Queries messages stored in a topic. You can query messages by creation time or offset.
 *
 * @param request QueryMessageRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryMessageResponse
 */
async function queryMessageWithOptions(request: QueryMessageRequest, runtime: Util.RuntimeOptions): QueryMessageResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryMessage',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries messages stored in a topic. You can query messages by creation time or offset.
 *
 * @param request QueryMessageRequest
 * @return QueryMessageResponse
 */
async function queryMessage(request: QueryMessageRequest): QueryMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryMessageWithOptions(request, runtime);
}

model ReleaseInstanceRequest {
  forceDeleteInstance?: boolean(name='ForceDeleteInstance', description='Specifies whether to immediately release the physical resources of the instance. Valid values:

*   **true**: The physical resources of the instance are immediately released.
*   **false**: The physical resources of the instance are retained for a period of time before they are released.', example='false'),
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_post-cn-mp919o4v****'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
}

model ReleaseInstanceResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='ABA4A7FD-E10F-45C7-9774-A5236015A***'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model ReleaseInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ReleaseInstanceResponseBody(name='body'),
}

/**
 * @summary Releases a pay-as-you-go instance.
 *
 * @description You cannot call this operation to release a subscription Message Queue for Apache Kafka instance.
 *
 * @param request ReleaseInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ReleaseInstanceResponse
 */
async function releaseInstanceWithOptions(request: ReleaseInstanceRequest, runtime: Util.RuntimeOptions): ReleaseInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.forceDeleteInstance)) {
    query['ForceDeleteInstance'] = request.forceDeleteInstance;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ReleaseInstance',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Releases a pay-as-you-go instance.
 *
 * @description You cannot call this operation to release a subscription Message Queue for Apache Kafka instance.
 *
 * @param request ReleaseInstanceRequest
 * @return ReleaseInstanceResponse
 */
async function releaseInstance(request: ReleaseInstanceRequest): ReleaseInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return releaseInstanceWithOptions(request, runtime);
}

model ReopenInstanceRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_post-cn-mp91inkw****'),
  regionId?: string(name='RegionId', description='The ID of the region where the instance resides.

This parameter is required.', example='cn-hangzhou'),
}

model ReopenInstanceResponseBody = {
  code?: int32(name='Code', description='The returned HTTP status code. If the request is successful, 200 is returned.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The request ID.', example='252820E1-A2E6-45F2-B4C9-1056B8CE****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model ReopenInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ReopenInstanceResponseBody(name='body'),
}

/**
 * @summary Enables an ApsaraMQ for Kafka instance.
 *
 * @description You can call this operation only if your instance is in the Stopped state.
 *
 * @param request ReopenInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ReopenInstanceResponse
 */
async function reopenInstanceWithOptions(request: ReopenInstanceRequest, runtime: Util.RuntimeOptions): ReopenInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ReopenInstance',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Enables an ApsaraMQ for Kafka instance.
 *
 * @description You can call this operation only if your instance is in the Stopped state.
 *
 * @param request ReopenInstanceRequest
 * @return ReopenInstanceResponse
 */
async function reopenInstance(request: ReopenInstanceRequest): ReopenInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return reopenInstanceWithOptions(request, runtime);
}

model StartInstanceRequest {
  config?: string(name='Config', description='The initial configurations of the ApsaraMQ for Kafka instance. The values must be valid JSON strings. If you do not specify this parameter, it is left empty.

> - You cannot configure this parameter when you deploy an ApsaraMQ for Confluent instance.
> - You cannot configure enable.acl for instances whose versions are earlier than 2.2.0.

The **Config** parameter supports the following parameters:

*   **enable.vpc_sasl_ssl**: specifies whether to enable VPC transmission encryption. Valid values:

    *   **true**: enables VPC transmission encryption. If you enable VPC transmission encryption, you must also enable access control list (ACL).
    *   **false**: disables VPC transmission encryption. This is the default value.

*   **enable.acl**: specifies whether to enable ACL. Valid values:

    *   **true**: enables ACL.
    *   **false**: disables the ACL feature. This is the default value.

*   **kafka.log.retention.hours**: the maximum message retention period when the disk capacity is sufficient. Unit: hours. Valid values: 24 to 480. Default value: **72**. When the disk usage reaches 85%, the disk capacity is insufficient. In this case, the system deletes the earliest stored messages to ensure service availability.

*   **kafka.message.max.bytes**: the maximum size of a message that can be sent and received by ApsaraMQ for Kafka. Unit: bytes. Valid values: 1048576 to 10485760. Default value: **1048576**. Before you change the maximum message size to a new value, make sure that the new value matches the configurations of the producers and consumers.', example='{"kafka.log.retention.hours":"33"}'),
  crossZone?: boolean(name='CrossZone', description='Specifies whether cross-zone deployment is required. Valid values:

*   true
*   false

Default value: true.', example='false'),
  deployModule?: string(name='DeployModule', description='The deployment mode. If the instance is an ApsaraMQ for Kafka V2 instance, this parameter is required. If the instance is an ApsaraMQ for Kafka V3 instance or an ApsaraMQ for Confluent instance, this parameter is optional. Valid values:

*   **vpc**: deploys the instance in a virtual private cloud (VPC).
*   **eip**: deploys the instance over the Internet and in the VPC.

The deployment mode of the ApsaraMQ for Kafka instance must be consistent with the instance type. If the instance is a VPC-connected instance, set this parameter to **vpc**. If the instance is an Internet- and VPC-connected instance, set this parameter to **eip**.', example='vpc'),
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_post-cn-v0h1fgs2****'),
  isEipInner?: boolean(name='IsEipInner', description='Specifies whether the instance supports elastic IP addresses (EIPs). Valid values:

*   **true**: supports EIPs and allows access from the Internet and a VPC.
*   **false**: does not support EIPs and allows access only from a VPC.

The value of this parameter must match the type of the instance. For example, if the instance allows access only from a VPC, set this parameter to **false**.', example='false'),
  isForceSelectedZones?: boolean(name='IsForceSelectedZones', description='Specifies whether to forcibly deploy the instance in the selected zones.', example='false'),
  isSetUserAndPassword?: boolean(name='IsSetUserAndPassword', description='Specifies whether to set a new username and password. Valid values:

*   **true**: sets a new username and password.
*   **false**: does not set a new username or password.

This parameter is available only if you deploy an instance that allows access from the Internet and a VPC.', example='false'),
  KMSKeyId?: string(name='KMSKeyId', description='The ID of the key that is used for disk encryption in the region where the instance is deployed. You can obtain the ID of the key in the [Key Management Service (KMS) console](https://kms.console.aliyun.com/?spm=a2c4g.11186623.2.5.336745b8hfiU21) or create a key. For more information, see [Manage CMKs](https://help.aliyun.com/document_detail/181610.html).

If this parameter is configured, disk encryption is enabled for the instance. You cannot disable disk encryption after disk encryption is enabled. When you call this operation, the system checks whether the AliyunServiceRoleForAlikafkaInstanceEncryption service-linked role is created. If the role is not created, the system automatically creates the role. For more information, see [Service-linked roles](https://help.aliyun.com/document_detail/190460.html).

> When you deploy a serverless ApsaraMQ for Kafka V3 instance, you cannot configure this parameter.', example='0d24xxxx-da7b-4786-b981-9a164dxxxxxx'),
  name?: string(name='Name', description='The name of the instance.

>  If you specify a value for this parameter, make sure that the specified value is unique in the region of the instance.', example='newInstanceName'),
  notifier?: string(name='Notifier', description='The alert contact.', example='Mr. Wang'),
  password?: string(name='Password', description='The instance password.

*   This parameter is available only for Internet- and VPC- connected ApsaraMQ for Kafka V2 and V3 instances.
*   If the instance is an ApsaraMQ for Confluent instance, this parameter is required. The value of this parameter must be 8 to 32 characters in length and contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. The following special characters are supported: ! @ # $ % ^ & \\\\* () _ + - =', example='password'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  securityGroup?: string(name='SecurityGroup', description='The security group of the instance.

If you do not specify this parameter, ApsaraMQ for Kafka automatically configures a security group for your instance. If you specify this parameter, you must create a security group in advance. For more information, see [Create a security group](https://help.aliyun.com/document_detail/25468.html).', example='sg-bp13wfx7kz9pko****'),
  selectedZones?: string(name='SelectedZones', description='The two-dimensional arrays that consist of the candidate set for primary zones and the candidate set for secondary zones. Custom code in the `zone {zone}` format and standard code in the `cn-RegionID-{zone}` format are supported.

*   If you set CrossZone to true and specify Zone H and Zone F as the candidate set for primary zones and Zone K as the candidate set for secondary zones, set this parameter to `[["zoneh","zonef"],["zonek"]]`.

> If you specify multiple zones as the primary or secondary zones, the system deploys the instance in one of the zones without prioritizing them. For example, if you set this parameter to `[["zoneh","zonef"],["zonek"]]`, the primary zone in which the instance is deployed can be Zone H or Zone F, and the secondary zone is Zone K.

*   If you set CrossZone to false and want to deploy the instance in Zone K, set this parameter to `[["zonek"],[]]`. In this case, the value of this parameter must still be two-dimensional arrays, but the array that specifies the candidate for secondary zones is left empty.', example='[[\\\\"zonel\\\\"],[\\\\"zonek\\\\"]]'),
  serviceVersion?: string(name='ServiceVersion', description='The version of the ApsaraMQ for Kafka instance. Valid values:

*   ApsaraMQ for Kafka V2 instances: 2.2.0 and 2.6.2.
*   ApsaraMQ for Kafka V3 instances: 3.3.1.
*   ApsaraMQ for Confluent instances: 7.4.0.

Default value:

*   ApsaraMQ for Kafka V2 instances: 2.2.0.
*   ApsaraMQ for Kafka V3 instances: 3.3.1.
*   ApsaraMQ for Confluent instances: 7.4.0.', example='ApsaraMQ for Kafka V2 instances: 2.2.0
ApsaraMQ for Kafka V3 instances: 3.3.1
ApsaraMQ for Confluent instances: 7.4.0'),
  userPhoneNum?: string(name='UserPhoneNum', description='The mobile phone number of the alert contact.', example='1581234****'),
  username?: string(name='Username', description='The instance username.

*   This parameter is available only for Internet- and VPC- connected ApsaraMQ for Kafka V2 and V3 instances.
*   If the instance is an ApsaraMQ for Confluent instance, set this parameter to root or leave this parameter empty.

Default value for ApsaraMQ for Kafka V2 and V3 instances: username. Default value for ApsaraMQ for Confluent instances: root.', example='username'),
  vSwitchId?: string(name='VSwitchId', description='The ID of the vSwitch to which you want to connect the instance.

This parameter is required.', example='vsw-bp1j3sg5979fstnpl****'),
  vSwitchIds?: [ string ](name='VSwitchIds', description='The IDs of the vSwitches with which the instance is associated. If the instance is an ApsaraMQ for Kafka V2 or V3 instance, this parameter is required. If the instance is an ApsaraMQ for Confluent instance, you must configure one of VSwitchIds and VSwitchId. If you configure both of the parameters, the value of VSwitchIds takes effect.'),
  vpcId?: string(name='VpcId', description='The ID of the virtual private cloud (VPC) in which you want to deploy the instance.

This parameter is required.', example='vpc-bp1r4eg3yrxmygv****'),
  zoneId?: string(name='ZoneId', description='The ID of the zone where you want to deploy the ApsaraMQ for Kafka instance.

*   The zone ID of the ApsaraMQ for Kafka instance must be the same as that of the vSwitch.
*   The value must be in the zoneX or Region ID-X format. Examples: zonea and cn-hangzhou-k.

>  If resources in the specified zone is insufficient, the instance may be deployed in another zone.', example='cn-hangzhou-k'),
}

model StartInstanceResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='ABA4A7FD-E10F-45C7-9774-A5236015****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model StartInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StartInstanceResponseBody(name='body'),
}

/**
 * @summary Deploys an ApsaraMQ for Kafka instance. You must purchase and deploy an ApsaraMQ for Kafka instance before you can use the instance to send and receive messages.
 *
 * @description >  You can call this operation up to twice per second.
 *
 * @param request StartInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StartInstanceResponse
 */
async function startInstanceWithOptions(request: StartInstanceRequest, runtime: Util.RuntimeOptions): StartInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.config)) {
    query['Config'] = request.config;
  }
  if (!Util.isUnset(request.crossZone)) {
    query['CrossZone'] = request.crossZone;
  }
  if (!Util.isUnset(request.deployModule)) {
    query['DeployModule'] = request.deployModule;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.isEipInner)) {
    query['IsEipInner'] = request.isEipInner;
  }
  if (!Util.isUnset(request.isForceSelectedZones)) {
    query['IsForceSelectedZones'] = request.isForceSelectedZones;
  }
  if (!Util.isUnset(request.isSetUserAndPassword)) {
    query['IsSetUserAndPassword'] = request.isSetUserAndPassword;
  }
  if (!Util.isUnset(request.KMSKeyId)) {
    query['KMSKeyId'] = request.KMSKeyId;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.notifier)) {
    query['Notifier'] = request.notifier;
  }
  if (!Util.isUnset(request.password)) {
    query['Password'] = request.password;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.securityGroup)) {
    query['SecurityGroup'] = request.securityGroup;
  }
  if (!Util.isUnset(request.selectedZones)) {
    query['SelectedZones'] = request.selectedZones;
  }
  if (!Util.isUnset(request.serviceVersion)) {
    query['ServiceVersion'] = request.serviceVersion;
  }
  if (!Util.isUnset(request.userPhoneNum)) {
    query['UserPhoneNum'] = request.userPhoneNum;
  }
  if (!Util.isUnset(request.username)) {
    query['Username'] = request.username;
  }
  if (!Util.isUnset(request.vSwitchId)) {
    query['VSwitchId'] = request.vSwitchId;
  }
  if (!Util.isUnset(request.vSwitchIds)) {
    query['VSwitchIds'] = request.vSwitchIds;
  }
  if (!Util.isUnset(request.vpcId)) {
    query['VpcId'] = request.vpcId;
  }
  if (!Util.isUnset(request.zoneId)) {
    query['ZoneId'] = request.zoneId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StartInstance',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deploys an ApsaraMQ for Kafka instance. You must purchase and deploy an ApsaraMQ for Kafka instance before you can use the instance to send and receive messages.
 *
 * @description >  You can call this operation up to twice per second.
 *
 * @param request StartInstanceRequest
 * @return StartInstanceResponse
 */
async function startInstance(request: StartInstanceRequest): StartInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return startInstanceWithOptions(request, runtime);
}

model StopInstanceRequest {
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_post-cn-v0h1fgs2****'),
  regionId?: string(name='RegionId', description='The ID of the region where the instance resides.

This parameter is required.', example='cn-hangzhou'),
}

model StopInstanceResponseBody = {
  code?: int32(name='Code', description='The returned status code. If the request is successful, 200 is returned.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The request ID.', example='17D425C2-4EA3-4AB8-928D-E10511ECF***'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model StopInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StopInstanceResponseBody(name='body'),
}

/**
 * @summary Stops an ApsaraMQ for Kafka instance.
 *
 * @description You cannot stop a subscription ApsaraMQ for Kafka instance. If you want to stop a subscription ApsaraMQ for Kafka instance, submit a ticket.
 *
 * @param request StopInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return StopInstanceResponse
 */
async function stopInstanceWithOptions(request: StopInstanceRequest, runtime: Util.RuntimeOptions): StopInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'StopInstance',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Stops an ApsaraMQ for Kafka instance.
 *
 * @description You cannot stop a subscription ApsaraMQ for Kafka instance. If you want to stop a subscription ApsaraMQ for Kafka instance, submit a ticket.
 *
 * @param request StopInstanceRequest
 * @return StopInstanceResponse
 */
async function stopInstance(request: StopInstanceRequest): StopInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return stopInstanceWithOptions(request, runtime);
}

model TagResourcesRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Message Queue for Apache RocketMQ instance which contains the resource to which you want to attach tags.', example='alikafka_post-cn-v0h1fgs2****'),
  regionId?: string(name='RegionId', description='The ID of the region in which the resource is deployed.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: [ string ](name='ResourceId', description='The resource IDs.

This parameter is required.', example='alikafka_post-cn-v0h1fgs2****'),
  resourceType?: string(name='ResourceType', description='The type of the resources. The value is an enumerated value. Valid values:

*   **INSTANCE**
*   **TOPIC**
*   **CONSUMERGROUP**

>  The value of this parameter is not case-sensitive.

This parameter is required.', example='instance'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key.

*   You must specify this parameter.
*   The tag key can be up to 128 characters in length and cannot contain `http://` or `https://`. The tag key cannot start with `acs:` or `aliyun`.

This parameter is required.', example='FinanceDept'),
      value?: string(name='Value', description='The tag value.

*   You can leave this parameter empty.
*   The tag value can be up to 128 characters in length and cannot contain http:// or https://. The tag value cannot start with acs: or aliyun.', example='FinanceJoshua'),
    }
  ](name='Tag', description='The tags.

This parameter is required.'),
}

model TagResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='C46FF5A8-C5F0-4024-8262-B16B6392****'),
}

model TagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: TagResourcesResponseBody(name='body'),
}

/**
 * @summary Attaches a tag to a resource.
 *
 * @param request TagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return TagResourcesResponse
 */
async function tagResourcesWithOptions(request: TagResourcesRequest, runtime: Util.RuntimeOptions): TagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'TagResources',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Attaches a tag to a resource.
 *
 * @param request TagResourcesRequest
 * @return TagResourcesResponse
 */
async function tagResources(request: TagResourcesRequest): TagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return tagResourcesWithOptions(request, runtime);
}

model UntagResourcesRequest {
  all?: boolean(name='All', description='Specifies whether to detach all tags from the resource. This parameter only takes effect when the TagKey.N parameter is not configured. Default value: **false**.', example='false'),
  regionId?: string(name='RegionId', description='The ID of the region in which the resource is deployed.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: [ string ](name='ResourceId', description='The IDs of the resources from which you want to detach tags.

This parameter is required.', example='alikafka_post-cn-v0h1fgs2****'),
  resourceType?: string(name='ResourceType', description='The type of the resources. Valid values:

*   **INSTANCE**
*   **TOPIC**
*   **CONSUMERGROUP**

>  The value of this parameter is not case-sensitive.

This parameter is required.', example='INSTANCE'),
  tagKey?: [ string ](name='TagKey', description='The key of the resource tag.', example='FinanceDept'),
}

model UntagResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='C46FF5A8-C5F0-4024-8262-B16B6392****'),
}

model UntagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UntagResourcesResponseBody(name='body'),
}

/**
 * @summary Detaches tags from a specified resource.
 *
 * @param request UntagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UntagResourcesResponse
 */
async function untagResourcesWithOptions(request: UntagResourcesRequest, runtime: Util.RuntimeOptions): UntagResourcesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.all)) {
    query['All'] = request.all;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!Util.isUnset(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!Util.isUnset(request.tagKey)) {
    query['TagKey'] = request.tagKey;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UntagResources',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Detaches tags from a specified resource.
 *
 * @param request UntagResourcesRequest
 * @return UntagResourcesResponse
 */
async function untagResources(request: UntagResourcesRequest): UntagResourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  return untagResourcesWithOptions(request, runtime);
}

model UpdateAllowedIpRequest {
  allowedListIp?: string(name='AllowedListIp', description='The IP addresses that you want to manage. You can specify a CIDR block. Example: **192.168.0.0/16**.

*   If the **UpdateType** parameter is set to **add**, specify one or more IP addresses for this parameter. Separate multiple IP addresses with commas (,).
*   If the **UpdateType** parameter is set to **delete**, specify only one IP address.
*   Exercise caution when you delete IP addresses.

This parameter is required.', example='0.0.0.0/0'),
  allowedListType?: string(name='AllowedListType', description='The type of the whitelist. Valid values:

*   **vpc**: a whitelist for access from a VPC.
*   **internet**: a whitelist for access from the Internet.

This parameter is required.', example='vpc'),
  description?: string(name='Description', description='The description of the whitelist.', example='tf-testAccEcsImageConfigBasic3549descriptionChange'),
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_pre-cn-0pp1cng20***'),
  portRange?: string(name='PortRange', description='The port range. Valid values:

*   **9092/9092**: Messages are transmitted in a virtual private cloud (VPC) by using the PLAINTEXT protocol.
*   **9093/9093**: Messages are transmitted over the Internet by using the SASL_SSL protocol.
*   **9094/9094**: Messages are transmitted in a VPC by using the SASL_PLAINTEXT protocol.
*   **9095/9095**: Messages are transmitted in a VPC by using the SASL_SSL protocol.

This parameter must correspond to **AllowdedListType**.

This parameter is required.', example='9092/9092'),
  regionId?: string(name='RegionId', description='The ID of the region where the instance resides.

This parameter is required.', example='cn-hangzhou'),
  updateType?: string(name='UpdateType', description='The type of configuration change. Valid values:

*   **add**
*   **delete**

This parameter is required.', example='add'),
}

model UpdateAllowedIpResponseBody = {
  code?: int32(name='Code', description='The HTTP status code that is returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The message returned.', example='operation success.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='17D425C2-4EA3-4AB8-928D-E10511ECF***'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model UpdateAllowedIpResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateAllowedIpResponseBody(name='body'),
}

/**
 * @summary Updates the IP address whitelist of an ApsaraMQ for Kafka instance. Only IP addresses and ports that are configured in the IP address whitelist of an instance can access the instance.
 *
 * @param request UpdateAllowedIpRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateAllowedIpResponse
 */
async function updateAllowedIpWithOptions(request: UpdateAllowedIpRequest, runtime: Util.RuntimeOptions): UpdateAllowedIpResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.allowedListIp)) {
    query['AllowedListIp'] = request.allowedListIp;
  }
  if (!Util.isUnset(request.allowedListType)) {
    query['AllowedListType'] = request.allowedListType;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.portRange)) {
    query['PortRange'] = request.portRange;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.updateType)) {
    query['UpdateType'] = request.updateType;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateAllowedIp',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Updates the IP address whitelist of an ApsaraMQ for Kafka instance. Only IP addresses and ports that are configured in the IP address whitelist of an instance can access the instance.
 *
 * @param request UpdateAllowedIpRequest
 * @return UpdateAllowedIpResponse
 */
async function updateAllowedIp(request: UpdateAllowedIpRequest): UpdateAllowedIpResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateAllowedIpWithOptions(request, runtime);
}

model UpdateConsumerOffsetRequest {
  consumerId?: string(name='ConsumerId', description='The name of the consumer group.

*   The name can contain letters, digits, hyphens (-), and underscores (_).
*   The name must be **3 to 64** characters in length. If a name contains more than **64** characters, the name is automatically truncated.
*   The name of a consumer group cannot be changed after the consumer group is created.

This parameter is required.', example='kafka-test'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_post-cn-mp91inkw****'),
  offsets?: [ 
    {
      offset?: long(name='Offset', description='The consumer offset of the partition.', example='1'),
      partition?: int32(name='Partition', description='The partition ID.', example='0'),
    }
  ](name='Offsets', description='If you set resetType to offset, you can use this parameter to reset the consumer offset of each partition of a specific topic in the consumer group.', nullable=true),
  regionId?: string(name='RegionId', description='The region ID of the instance to which the consumer group belongs.

This parameter is required.', example='cn-hangzhou'),
  resetType?: string(name='ResetType', description='The method that is used to reset the consumer offsets of the subscribed topics of a consumer group. Valid values:

*   **timestamp** (default)
*   **offset**', example='timestamp'),
  time?: string(name='Time', description='The point in time when message consumption starts. The value of this parameter is a UNIX timestamp in milliseconds. The value of this parameter must be **less than 0** or **within the retention period of the consumer offset**. This parameter takes effect only if you set resetType to timestamp.

*   If you want to reset the consumer offset to the latest offset, set this parameter to -1.
*   If you want to reset the consumer offset to the earliest offset, set this parameter to -2.', example='-1'),
  topic?: string(name='Topic', description='The topic name.

*   The name can contain letters, digits, underscores (_), and hyphens (-).
*   The name must be **3 to 64** characters in length. If a name contains more than **64** characters, the name is automatically truncated.
*   The name of a topic cannot be changed after the topic is created.

**If you want to reset the consumer offsets of all topics to which the consumer subscribes, specify an empty string.**

This parameter is required.', example='topic_name'),
}

model UpdateConsumerOffsetShrinkRequest {
  consumerId?: string(name='ConsumerId', description='The name of the consumer group.

*   The name can contain letters, digits, hyphens (-), and underscores (_).
*   The name must be **3 to 64** characters in length. If a name contains more than **64** characters, the name is automatically truncated.
*   The name of a consumer group cannot be changed after the consumer group is created.

This parameter is required.', example='kafka-test'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_post-cn-mp91inkw****'),
  offsetsShrink?: string(name='Offsets', description='If you set resetType to offset, you can use this parameter to reset the consumer offset of each partition of a specific topic in the consumer group.', nullable=true),
  regionId?: string(name='RegionId', description='The region ID of the instance to which the consumer group belongs.

This parameter is required.', example='cn-hangzhou'),
  resetType?: string(name='ResetType', description='The method that is used to reset the consumer offsets of the subscribed topics of a consumer group. Valid values:

*   **timestamp** (default)
*   **offset**', example='timestamp'),
  time?: string(name='Time', description='The point in time when message consumption starts. The value of this parameter is a UNIX timestamp in milliseconds. The value of this parameter must be **less than 0** or **within the retention period of the consumer offset**. This parameter takes effect only if you set resetType to timestamp.

*   If you want to reset the consumer offset to the latest offset, set this parameter to -1.
*   If you want to reset the consumer offset to the earliest offset, set this parameter to -2.', example='-1'),
  topic?: string(name='Topic', description='The topic name.

*   The name can contain letters, digits, underscores (_), and hyphens (-).
*   The name must be **3 to 64** characters in length. If a name contains more than **64** characters, the name is automatically truncated.
*   The name of a topic cannot be changed after the topic is created.

**If you want to reset the consumer offsets of all topics to which the consumer subscribes, specify an empty string.**

This parameter is required.', example='topic_name'),
}

model UpdateConsumerOffsetResponseBody = {
  code?: int32(name='Code', description='The HTTP status code that is returned. The status code **200** indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success'),
  requestId?: string(name='RequestId', description='The request ID.', example='56729737-C428-4E1B-AC68-7A8C2D5****'),
  success?: boolean(name='Success', description='Indicates whether the call was successful.', example='true'),
}

model UpdateConsumerOffsetResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateConsumerOffsetResponseBody(name='body'),
}

/**
 * @summary Resets the consumer offsets of the subscribed topics of a consumer group.
 *
 * @description You can call this operation to reset the consumer offset of a specific consumer group. You can use the timestamp or offset parameter to reset the consumer offset of a consumer group. You can implement the following features by configuring a combination of different parameters:
 * *   Reset the consumer offsets of one or all subscribed topics of a consumer group to the latest offset. This way, you can consume messages in the topics from the latest offset.
 * *   Reset the consumer offsets of one or all subscribed topics of a consumer group to a specific point in time. This way, you can consume messages in the topics from the specified point in time.
 * *   Reset the consumer offset of one subscribed topic of a consumer group to a specific offset in a specific partition. This way, you can consume messages from the specified offset in the specified partition.
 *
 * @param tmpReq UpdateConsumerOffsetRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateConsumerOffsetResponse
 */
async function updateConsumerOffsetWithOptions(tmpReq: UpdateConsumerOffsetRequest, runtime: Util.RuntimeOptions): UpdateConsumerOffsetResponse {
  Util.validateModel(tmpReq);
  var request = new UpdateConsumerOffsetShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.offsets)) {
    request.offsetsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.offsets, 'Offsets', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.consumerId)) {
    query['ConsumerId'] = request.consumerId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.offsetsShrink)) {
    query['Offsets'] = request.offsetsShrink;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.resetType)) {
    query['ResetType'] = request.resetType;
  }
  if (!Util.isUnset(request.time)) {
    query['Time'] = request.time;
  }
  if (!Util.isUnset(request.topic)) {
    query['Topic'] = request.topic;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateConsumerOffset',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Resets the consumer offsets of the subscribed topics of a consumer group.
 *
 * @description You can call this operation to reset the consumer offset of a specific consumer group. You can use the timestamp or offset parameter to reset the consumer offset of a consumer group. You can implement the following features by configuring a combination of different parameters:
 * *   Reset the consumer offsets of one or all subscribed topics of a consumer group to the latest offset. This way, you can consume messages in the topics from the latest offset.
 * *   Reset the consumer offsets of one or all subscribed topics of a consumer group to a specific point in time. This way, you can consume messages in the topics from the specified point in time.
 * *   Reset the consumer offset of one subscribed topic of a consumer group to a specific offset in a specific partition. This way, you can consume messages from the specified offset in the specified partition.
 *
 * @param request UpdateConsumerOffsetRequest
 * @return UpdateConsumerOffsetResponse
 */
async function updateConsumerOffset(request: UpdateConsumerOffsetRequest): UpdateConsumerOffsetResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateConsumerOffsetWithOptions(request, runtime);
}

model UpdateInstanceConfigRequest {
  config?: string(name='Config', description='The configurations that you want to update for the ApsaraMQ for Kafka instance. The value must be a valid JSON string.

This parameter is required.', example='{"kafka.log.retention.hours":"33"}'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_post-cn-v0h1fgs2****'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
}

model UpdateInstanceConfigResponseBody = {
  code?: int32(name='Code', description='The HTTP status code. The status code 200 indicates that the call is successful.', example='200'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The request ID.', example='4B6D821D-7F67-4CAA-9E13-A5A997C35***'),
  success?: boolean(name='Success', description='Indicates whether the call is successful.', example='true'),
}

model UpdateInstanceConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateInstanceConfigResponseBody(name='body'),
}

/**
 * @summary Modifies the configurations of an ApsaraMQ for Kafka instance. ApsaraMQ for Kafka allows you to modify the configurations of an instance, including the access control list (ACL) feature, the Secure Sockets Layer (SSL) feature, the message retention period, and the maximum message size.
 *
 * @description ## **Permissions**
 * If a RAM user wants to call the **UpdateInstanceConfig** operation, the RAM user must be granted the required permissions. For more information about how to grant permissions, see [RAM policies](https://help.aliyun.com/document_detail/185815.html).
 * |API|Action|Resource|
 * |---|---|---|
 * |UpdateInstanceConfig|alikafka: UpdateInstance|acs:alikafka:*:*:{instanceId}|
 *
 * @param request UpdateInstanceConfigRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateInstanceConfigResponse
 */
async function updateInstanceConfigWithOptions(request: UpdateInstanceConfigRequest, runtime: Util.RuntimeOptions): UpdateInstanceConfigResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.config)) {
    query['Config'] = request.config;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateInstanceConfig',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the configurations of an ApsaraMQ for Kafka instance. ApsaraMQ for Kafka allows you to modify the configurations of an instance, including the access control list (ACL) feature, the Secure Sockets Layer (SSL) feature, the message retention period, and the maximum message size.
 *
 * @description ## **Permissions**
 * If a RAM user wants to call the **UpdateInstanceConfig** operation, the RAM user must be granted the required permissions. For more information about how to grant permissions, see [RAM policies](https://help.aliyun.com/document_detail/185815.html).
 * |API|Action|Resource|
 * |---|---|---|
 * |UpdateInstanceConfig|alikafka: UpdateInstance|acs:alikafka:*:*:{instanceId}|
 *
 * @param request UpdateInstanceConfigRequest
 * @return UpdateInstanceConfigResponse
 */
async function updateInstanceConfig(request: UpdateInstanceConfigRequest): UpdateInstanceConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateInstanceConfigWithOptions(request, runtime);
}

model UpdateTopicConfigRequest {
  config?: string(name='Config', description='The key of the topic configuration.

*   For reserved instances, you can modify only the configurations of the topics that use local storage.
*   For serverless instances, you can modify the configurations of all topics.
*   Reserved instances whose topics use local storage support the following keys: retention.ms, max.message.bytes, replications, message.timestamp.type, and message.timestamp.difference.max.ms.``
*   Serverless instances support the following keys: retention.hours, max.message.bytes, message.timestamp.type, message.timestamp.difference.max.ms.

This parameter is required.', example='replications'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_post-cn-v0h1fgs2****'),
  regionId?: string(name='RegionId', description='The ID of the region where the instance resides.

This parameter is required.', example='cn-hangzhou'),
  topic?: string(name='Topic', description='The topic name.

This parameter is required.', example='dqc_test2'),
  value?: string(name='Value', description='The value of the topic configuration.

*   Serverless instances support the following values:

    *   `retention.hours`: the message retention period. Value type: string. Valid values: 24 to 8760.
    *   `max.message.bytes`: the maximum size of a sent message. Value type: string. Valid values: 1048576 to 10485760.
    *   `message.timestamp.type`: the timestamp type of a message. Valid values: CreateTime and LogAppendTime. The value CreateTime specifies the timestamp that is specified by the producer when the message is sent. The value LogAppendTime specifies the time when the broker appends the message to its log. If you do not specify this parameter, the time when the message is created on the client is used.
    *   `message.timestamp.difference.max.ms`: the maximum positive or negative difference allowed between the timestamp when the broker receives a message and the timestamp specified in the message. If you set message.timestamp.type to CreateTime, **a message is rejected** if the difference in timestamp exceeds the threshold. If you set message.timestamp.type to LogAppendTime, this configuration does not take effect.

*   Reserved instances support the following values:

    *   `retention.ms`: the message retention period. Value type: string. Valid values: 3600000 to 31536000000.
    *   `max.message.bytes`: the maximum size of a sent message. Value type: string. Valid values: 1048576 to 10485760.
    *   `replications`: the number of replicas. Value type: string. Valid values: 1 to 3.
    *   `message.timestamp.type`: the timestamp type of a message. Valid values: CreateTime and LogAppendTime. The value CreateTime specifies the timestamp that is specified by the producer when the message is sent. The value LogAppendTime specifies the time when the broker appends the message to its log. If you do not specify this parameter, the time when the message is created on the client is used.
    *   `message.timestamp.difference.max.ms`: the maximum positive or negative difference allowed between the timestamp when the broker receives a message and the timestamp specified in the message. If you set message.timestamp.type to CreateTime, **a message is rejected** if the difference in timestamp exceeds the threshold. If you set message.timestamp.type to LogAppendTime, this configuration does not take effect.

This parameter is required.', example='3'),
}

model UpdateTopicConfigResponseBody = {
  code?: long(name='Code', description='The HTTP status code. If the request is successful, 200 is returned.', example='200'),
  data?: string(name='Data', description='The returned data.', example='[]'),
  message?: string(name='Message', description='The returned message.', example='operation success.'),
  requestId?: string(name='RequestId', description='The request ID.', example='0178A3A7-E87B-5E50-A16F-3E62F534****'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='True'),
}

model UpdateTopicConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateTopicConfigResponseBody(name='body'),
}

/**
 * @summary Modifies the configurations of a topic. After you create a topic, you can modify the message retention period and maximum message size of the topic.
 *
 * @param request UpdateTopicConfigRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateTopicConfigResponse
 */
async function updateTopicConfigWithOptions(request: UpdateTopicConfigRequest, runtime: Util.RuntimeOptions): UpdateTopicConfigResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.config)) {
    query['Config'] = request.config;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.topic)) {
    query['Topic'] = request.topic;
  }
  if (!Util.isUnset(request.value)) {
    query['Value'] = request.value;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateTopicConfig',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the configurations of a topic. After you create a topic, you can modify the message retention period and maximum message size of the topic.
 *
 * @param request UpdateTopicConfigRequest
 * @return UpdateTopicConfigResponse
 */
async function updateTopicConfig(request: UpdateTopicConfigRequest): UpdateTopicConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateTopicConfigWithOptions(request, runtime);
}

model UpgradeInstanceVersionRequest {
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_post-cn-v0h1fgs2****'),
  regionId?: string(name='RegionId', description='The ID of the region where the instance resides.

This parameter is required.', example='cn-hangzhou'),
  targetVersion?: string(name='TargetVersion', description='The major version to be upgraded to. Valid values:

*   **0.10.2**
*   **2.2.0**

If you set this parameter to the current major version, the system upgrades the instance to the latest minor version.

This parameter is required.', example='0.10.2'),
}

model UpgradeInstanceVersionResponseBody = {
  code?: int32(name='Code', description='The HTTP status code that is returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The error message returned.', example='operation success.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='ABA4A7FD-E10F-45C7-9774-A5236015***'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model UpgradeInstanceVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpgradeInstanceVersionResponseBody(name='body'),
}

/**
 * @summary Updates the version of an instance.
 *
 * @description ## **Permissions**
 * A RAM user must be granted the required permissions before the RAM user calls the **UpgradeInstanceVersion** operation. For information about how to grant permissions, see [RAM policies](https://help.aliyun.com/document_detail/185815.html).
 * |API|Action|Resource|
 * |---|---|---|
 * |UpgradeInstanceVersion|UpdateInstance|acs:alikafka:*:*:{instanceId}|
 * ## **QPS limits**
 * You can send a maximum of two queries per second (QPS).
 *
 * @param request UpgradeInstanceVersionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpgradeInstanceVersionResponse
 */
async function upgradeInstanceVersionWithOptions(request: UpgradeInstanceVersionRequest, runtime: Util.RuntimeOptions): UpgradeInstanceVersionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.targetVersion)) {
    query['TargetVersion'] = request.targetVersion;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpgradeInstanceVersion',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Updates the version of an instance.
 *
 * @description ## **Permissions**
 * A RAM user must be granted the required permissions before the RAM user calls the **UpgradeInstanceVersion** operation. For information about how to grant permissions, see [RAM policies](https://help.aliyun.com/document_detail/185815.html).
 * |API|Action|Resource|
 * |---|---|---|
 * |UpgradeInstanceVersion|UpdateInstance|acs:alikafka:*:*:{instanceId}|
 * ## **QPS limits**
 * You can send a maximum of two queries per second (QPS).
 *
 * @param request UpgradeInstanceVersionRequest
 * @return UpgradeInstanceVersionResponse
 */
async function upgradeInstanceVersion(request: UpgradeInstanceVersionRequest): UpgradeInstanceVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  return upgradeInstanceVersionWithOptions(request, runtime);
}

model UpgradePostPayOrderRequest {
  diskSize?: int32(name='DiskSize', description='The disk size. Unit: GB.

*   The disk size that you specify must be greater than or equal to the current disk size of the instance.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If the instance is a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='500'),
  eipMax?: int32(name='EipMax', description='The maximum Internet traffic of the instance.

*   The Internet traffic that you specify must be greater than or equal to the current Internet traffic of the instance.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

> 

*   If you set **EipModel** to **true**, set **EipMax** to a value that is greater than 0.

*   If you set **EipModel** to **false**, set **EipMax** to **0**.

*   If the instance is a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='0'),
  eipModel?: boolean(name='EipModel', description='Specifies whether to enable Internet access for the instance. Valid values:

*   true: enables Internet access.
*   false: disables Internet access.', example='false'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_post-cn-mp919o4v****'),
  ioMax?: int32(name='IoMax', description='The maximum traffic of the instance. We recommend that you do not configure this parameter.

*   The maximum traffic that you specify must be greater than or equal to the current maximum traffic of the instance.
*   You must configure at least one of IoMax and IoMaxSpec. If you configure both parameters, the value of IoMaxSpec takes effect. We recommend that you configure only IoMaxSpec.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If the instance is a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='60'),
  ioMaxSpec?: string(name='IoMaxSpec', description='The traffic specification of the instance. We recommend that you configure this parameter.

*   The traffic specification that you specify must be greater than or equal to the current traffic specification of the instance.
*   You must configure at least one of IoMax and IoMaxSpec. If you configure both parameters, the value of IoMaxSpec takes effect. We recommend that you configure only IoMaxSpec.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If the instance is a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='alikafka.hw.6xlarge'),
  partitionNum?: int32(name='PartitionNum', description='The number of partitions. We recommend that you configure this parameter.

*   You must configure one of PartitionNum and TopicQuota. We recommend that you configure only PartitionNum.
*   If you configure PartitionNum and TopicQuota at the same time, the system verifies whether the price of the partitions equals the price of the topics based on the previous topic-based selling mode. If the price of the partitions does not equal the price of the topics, an error is returned. If the price of the partitions equals the price of the topics, the instance is purchased based on the partition number.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If the instance is a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='80'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  serverlessConfig?: {
    reservedPublishCapacity?: long(name='ReservedPublishCapacity', description='The reserved capacity for publishing messages. You can specify only an integer for this parameter. Minimum value: 60.

>  The maximum capacity that you can reserve for an instance varies based on available resources in a region. The reserved capacity range displayed on the buy page shall prevail.', example='50'),
    reservedSubscribeCapacity?: long(name='ReservedSubscribeCapacity', description='The reserved capacity for subscribing to messages. You can specify only an integer for this parameter. Minimum value: 50.

>  The maximum capacity that you can reserve for an instance varies based on available resources in a region. The reserved capacity range displayed on the buy page shall prevail.', example='50'),
  }(name='ServerlessConfig', description='The parameters that are configured for the serverless instance. These parameters are required only when you create a serverless instance.'),
  specType?: string(name='SpecType', description='The instance edition.

Valid values for this parameter if you set PaidType to 1:

*   normal: Standard Edition (High Write)
*   professional: Professional Edition (High Write)
*   professionalForHighRead: Professional Edition (High Read)

Valid values for this parameter if you set PaidType to 3:

*   normal: Serverless Standard Edition

For more information, see [Billing](https://help.aliyun.com/document_detail/84737.html).', example='professional'),
  topicQuota?: int32(name='TopicQuota', description='The number of topics. We recommend that you do not configure this parameter.

*   You must configure one of PartitionNum and TopicQuota. We recommend that you configure only PartitionNum.
*   If you configure PartitionNum and TopicQuota at the same time, the system verifies whether the price of the partitions equals the price of the topics based on the previous topic-based selling mode. If the price of the partitions does not equal the price of the topics, an error is returned. If the price of the partitions equals the price of the topics, the instance is purchased based on the partition number.
*   The default value of TopicQuota varies based on the value of IoMaxSpec. If the number of topics that you use exceeds the default value, you are charged additional fees.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If the instance is a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='80'),
}

model UpgradePostPayOrderShrinkRequest {
  diskSize?: int32(name='DiskSize', description='The disk size. Unit: GB.

*   The disk size that you specify must be greater than or equal to the current disk size of the instance.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If the instance is a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='500'),
  eipMax?: int32(name='EipMax', description='The maximum Internet traffic of the instance.

*   The Internet traffic that you specify must be greater than or equal to the current Internet traffic of the instance.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

> 

*   If you set **EipModel** to **true**, set **EipMax** to a value that is greater than 0.

*   If you set **EipModel** to **false**, set **EipMax** to **0**.

*   If the instance is a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='0'),
  eipModel?: boolean(name='EipModel', description='Specifies whether to enable Internet access for the instance. Valid values:

*   true: enables Internet access.
*   false: disables Internet access.', example='false'),
  instanceId?: string(name='InstanceId', description='The instance ID.

This parameter is required.', example='alikafka_post-cn-mp919o4v****'),
  ioMax?: int32(name='IoMax', description='The maximum traffic of the instance. We recommend that you do not configure this parameter.

*   The maximum traffic that you specify must be greater than or equal to the current maximum traffic of the instance.
*   You must configure at least one of IoMax and IoMaxSpec. If you configure both parameters, the value of IoMaxSpec takes effect. We recommend that you configure only IoMaxSpec.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If the instance is a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='60'),
  ioMaxSpec?: string(name='IoMaxSpec', description='The traffic specification of the instance. We recommend that you configure this parameter.

*   The traffic specification that you specify must be greater than or equal to the current traffic specification of the instance.
*   You must configure at least one of IoMax and IoMaxSpec. If you configure both parameters, the value of IoMaxSpec takes effect. We recommend that you configure only IoMaxSpec.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If the instance is a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='alikafka.hw.6xlarge'),
  partitionNum?: int32(name='PartitionNum', description='The number of partitions. We recommend that you configure this parameter.

*   You must configure one of PartitionNum and TopicQuota. We recommend that you configure only PartitionNum.
*   If you configure PartitionNum and TopicQuota at the same time, the system verifies whether the price of the partitions equals the price of the topics based on the previous topic-based selling mode. If the price of the partitions does not equal the price of the topics, an error is returned. If the price of the partitions equals the price of the topics, the instance is purchased based on the partition number.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If the instance is a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='80'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  serverlessConfigShrink?: string(name='ServerlessConfig', description='The parameters that are configured for the serverless instance. These parameters are required only when you create a serverless instance.'),
  specType?: string(name='SpecType', description='The instance edition.

Valid values for this parameter if you set PaidType to 1:

*   normal: Standard Edition (High Write)
*   professional: Professional Edition (High Write)
*   professionalForHighRead: Professional Edition (High Read)

Valid values for this parameter if you set PaidType to 3:

*   normal: Serverless Standard Edition

For more information, see [Billing](https://help.aliyun.com/document_detail/84737.html).', example='professional'),
  topicQuota?: int32(name='TopicQuota', description='The number of topics. We recommend that you do not configure this parameter.

*   You must configure one of PartitionNum and TopicQuota. We recommend that you configure only PartitionNum.
*   If you configure PartitionNum and TopicQuota at the same time, the system verifies whether the price of the partitions equals the price of the topics based on the previous topic-based selling mode. If the price of the partitions does not equal the price of the topics, an error is returned. If the price of the partitions equals the price of the topics, the instance is purchased based on the partition number.
*   The default value of TopicQuota varies based on the value of IoMaxSpec. If the number of topics that you use exceeds the default value, you are charged additional fees.
*   For information about the valid values of this parameter, see [Billing](https://help.aliyun.com/document_detail/84737.html).

>  If the instance is a serverless ApsaraMQ for Kafka instance, you do not need to configure this parameter.', example='80'),
}

model UpgradePostPayOrderResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The message returned.', example='operation success.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='ABA4A7FD-E10F-45C7-9774-A5236015A***'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model UpgradePostPayOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpgradePostPayOrderResponseBody(name='body'),
}

/**
 * @summary Upgrades a pay-as-you-go ApsaraMQ for Kafka instance.
 *
 * @description Before you call this operation, make sure that you understand the billing method and pricing of pay-as-you-go Message Queue for Apache Kafka instances. For more information, see [Billing](https://help.aliyun.com/document_detail/84737.html).
 *
 * @param tmpReq UpgradePostPayOrderRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpgradePostPayOrderResponse
 */
async function upgradePostPayOrderWithOptions(tmpReq: UpgradePostPayOrderRequest, runtime: Util.RuntimeOptions): UpgradePostPayOrderResponse {
  Util.validateModel(tmpReq);
  var request = new UpgradePostPayOrderShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.serverlessConfig)) {
    request.serverlessConfigShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.serverlessConfig, 'ServerlessConfig', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.diskSize)) {
    query['DiskSize'] = request.diskSize;
  }
  if (!Util.isUnset(request.eipMax)) {
    query['EipMax'] = request.eipMax;
  }
  if (!Util.isUnset(request.eipModel)) {
    query['EipModel'] = request.eipModel;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ioMax)) {
    query['IoMax'] = request.ioMax;
  }
  if (!Util.isUnset(request.ioMaxSpec)) {
    query['IoMaxSpec'] = request.ioMaxSpec;
  }
  if (!Util.isUnset(request.partitionNum)) {
    query['PartitionNum'] = request.partitionNum;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.serverlessConfigShrink)) {
    query['ServerlessConfig'] = request.serverlessConfigShrink;
  }
  if (!Util.isUnset(request.specType)) {
    query['SpecType'] = request.specType;
  }
  if (!Util.isUnset(request.topicQuota)) {
    query['TopicQuota'] = request.topicQuota;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpgradePostPayOrder',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Upgrades a pay-as-you-go ApsaraMQ for Kafka instance.
 *
 * @description Before you call this operation, make sure that you understand the billing method and pricing of pay-as-you-go Message Queue for Apache Kafka instances. For more information, see [Billing](https://help.aliyun.com/document_detail/84737.html).
 *
 * @param request UpgradePostPayOrderRequest
 * @return UpgradePostPayOrderResponse
 */
async function upgradePostPayOrder(request: UpgradePostPayOrderRequest): UpgradePostPayOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  return upgradePostPayOrderWithOptions(request, runtime);
}

model UpgradePrePayOrderRequest {
  confluentConfig?: {
    connectCU?: int32(name='ConnectCU'),
    connectReplica?: int32(name='ConnectReplica'),
    controlCenterCU?: int32(name='ControlCenterCU'),
    controlCenterReplica?: int32(name='ControlCenterReplica'),
    controlCenterStorage?: int32(name='ControlCenterStorage'),
    kafkaCU?: int32(name='KafkaCU'),
    kafkaReplica?: int32(name='KafkaReplica'),
    kafkaRestProxyCU?: int32(name='KafkaRestProxyCU'),
    kafkaRestProxyReplica?: int32(name='KafkaRestProxyReplica'),
    kafkaStorage?: int32(name='KafkaStorage'),
    ksqlCU?: int32(name='KsqlCU'),
    ksqlReplica?: int32(name='KsqlReplica'),
    ksqlStorage?: int32(name='KsqlStorage'),
    schemaRegistryCU?: int32(name='SchemaRegistryCU'),
    schemaRegistryReplica?: int32(name='SchemaRegistryReplica'),
    zooKeeperCU?: int32(name='ZooKeeperCU'),
    zooKeeperReplica?: int32(name='ZooKeeperReplica'),
    zooKeeperStorage?: int32(name='ZooKeeperStorage'),
  }(name='ConfluentConfig'),
  diskSize?: int32(name='DiskSize', description='The size of the disk.

*   The disk size that you specify must be greater than or equal to the current disk size of the instance.
*   For more information about the valid values, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).', example='900'),
  eipMax?: int32(name='EipMax', description='The Internet traffic for the instance.

*   The Internet traffic volume that you specify must be greater than or equal to the current Internet traffic volume of the instance.
*   For more information about the valid values, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).
> - If the **EipModel** parameter is set to **true**, set the **EipMax** parameter to a value that is greater than 0.
> - If the **EipModel** parameter is set to **false**, set the **EipMax** parameter to **0**.', example='3'),
  eipModel?: boolean(name='EipModel', description='Specifies whether to enable Internet access for the instance. Valid values:

*   true: enables Internet access.
*   false: disables Internet access.', example='true'),
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_post-cn-mp919o4v****'),
  ioMax?: int32(name='IoMax', description='The maximum traffic for the instance. We recommend that you do not configure this parameter.

*   The maximum traffic volume that you specify must be greater than or equal to the current maximum traffic volume of the instance.
*   You must configure at least one of the IoMax and IoMaxSpec parameters. If you configure both parameters, the value of the IoMaxSpec parameter takes effect. We recommend that you configure only the IoMaxSpec parameter.
*   For more information about the valid values, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).', example='40'),
  ioMaxSpec?: string(name='IoMaxSpec', description='The traffic specification of the instance. We recommend that you configure this parameter.

*   The traffic specification that you specify must be greater than or equal to the current traffic specification of the instance.
*   You must configure at least one of the IoMax and IoMaxSpec parameters. If you configure both parameters, the value of the IoMaxSpec parameter takes effect. We recommend that you configure only the IoMaxSpec parameter.
*   For more information about the valid values, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).', example='alikafka.hw.2xlarge'),
  paidType?: int32(name='PaidType'),
  partitionNum?: int32(name='PartitionNum', description='The number of partitions. We recommend that you configure this parameter.

*   You must specify at least one of the PartitionNum and TopicQuota parameters. We recommend that you configure only the PartitionNum parameter.
*   If you specify both parameters, the topic-based sales model is used to check whether the PartitionNum value and the TopicQuota value are the same. If they are not the same, a failure response is returned. If they are the same, the order is placed based on the PartitionNum value.
*   For more information about the valid values, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).', example='50'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  specType?: string(name='SpecType', description='The edition of the instance. Valid values:

*   **normal**: Standard Edition (High Write)
*   **professional**: Professional Edition (High Write)
*   **professionalForHighRead**: Professional Edition (High Read)

You cannot downgrade an instance from the Professional Edition to the Standard Edition. For more information about these instance editions, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).', example='professional'),
  topicQuota?: int32(name='TopicQuota', description='The number of topics. We recommend that you do not configure this parameter.

*   You must specify at least one of the PartitionNum and TopicQuota parameters. We recommend that you configure only the PartitionNum parameter.
*   If you specify both parameters, the topic-based sales model is used to check whether the PartitionNum value and the TopicQuota value are the same. If they are not the same, a failure response is returned. If they are the same, the order is placed based on the PartitionNum value.
*   The default value of the TopicQuota parameter varies based on the value of the IoMaxSpec parameter. If the number of topics that you consume exceeds the default value, you are charged additional fees.
*   For more information about the valid values, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).', example='50'),
}

model UpgradePrePayOrderShrinkRequest {
  confluentConfigShrink?: string(name='ConfluentConfig'),
  diskSize?: int32(name='DiskSize', description='The size of the disk.

*   The disk size that you specify must be greater than or equal to the current disk size of the instance.
*   For more information about the valid values, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).', example='900'),
  eipMax?: int32(name='EipMax', description='The Internet traffic for the instance.

*   The Internet traffic volume that you specify must be greater than or equal to the current Internet traffic volume of the instance.
*   For more information about the valid values, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).
> - If the **EipModel** parameter is set to **true**, set the **EipMax** parameter to a value that is greater than 0.
> - If the **EipModel** parameter is set to **false**, set the **EipMax** parameter to **0**.', example='3'),
  eipModel?: boolean(name='EipModel', description='Specifies whether to enable Internet access for the instance. Valid values:

*   true: enables Internet access.
*   false: disables Internet access.', example='true'),
  instanceId?: string(name='InstanceId', description='The ID of the instance.

This parameter is required.', example='alikafka_post-cn-mp919o4v****'),
  ioMax?: int32(name='IoMax', description='The maximum traffic for the instance. We recommend that you do not configure this parameter.

*   The maximum traffic volume that you specify must be greater than or equal to the current maximum traffic volume of the instance.
*   You must configure at least one of the IoMax and IoMaxSpec parameters. If you configure both parameters, the value of the IoMaxSpec parameter takes effect. We recommend that you configure only the IoMaxSpec parameter.
*   For more information about the valid values, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).', example='40'),
  ioMaxSpec?: string(name='IoMaxSpec', description='The traffic specification of the instance. We recommend that you configure this parameter.

*   The traffic specification that you specify must be greater than or equal to the current traffic specification of the instance.
*   You must configure at least one of the IoMax and IoMaxSpec parameters. If you configure both parameters, the value of the IoMaxSpec parameter takes effect. We recommend that you configure only the IoMaxSpec parameter.
*   For more information about the valid values, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).', example='alikafka.hw.2xlarge'),
  paidType?: int32(name='PaidType'),
  partitionNum?: int32(name='PartitionNum', description='The number of partitions. We recommend that you configure this parameter.

*   You must specify at least one of the PartitionNum and TopicQuota parameters. We recommend that you configure only the PartitionNum parameter.
*   If you specify both parameters, the topic-based sales model is used to check whether the PartitionNum value and the TopicQuota value are the same. If they are not the same, a failure response is returned. If they are the same, the order is placed based on the PartitionNum value.
*   For more information about the valid values, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).', example='50'),
  regionId?: string(name='RegionId', description='The region ID of the instance.

This parameter is required.', example='cn-hangzhou'),
  specType?: string(name='SpecType', description='The edition of the instance. Valid values:

*   **normal**: Standard Edition (High Write)
*   **professional**: Professional Edition (High Write)
*   **professionalForHighRead**: Professional Edition (High Read)

You cannot downgrade an instance from the Professional Edition to the Standard Edition. For more information about these instance editions, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).', example='professional'),
  topicQuota?: int32(name='TopicQuota', description='The number of topics. We recommend that you do not configure this parameter.

*   You must specify at least one of the PartitionNum and TopicQuota parameters. We recommend that you configure only the PartitionNum parameter.
*   If you specify both parameters, the topic-based sales model is used to check whether the PartitionNum value and the TopicQuota value are the same. If they are not the same, a failure response is returned. If they are the same, the order is placed based on the PartitionNum value.
*   The default value of the TopicQuota parameter varies based on the value of the IoMaxSpec parameter. If the number of topics that you consume exceeds the default value, you are charged additional fees.
*   For more information about the valid values, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).', example='50'),
}

model UpgradePrePayOrderResponseBody = {
  code?: int32(name='Code', description='The HTTP status code returned. The HTTP status code 200 indicates that the request is successful.', example='200'),
  message?: string(name='Message', description='The error message returned.', example='operation success.'),
  orderId?: string(name='OrderId'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='ABA4A7FD-E10F-45C7-9774-A5236015***'),
  success?: boolean(name='Success', description='Indicates whether the request is successful.', example='true'),
}

model UpgradePrePayOrderResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpgradePrePayOrderResponseBody(name='body'),
}

/**
 * @summary Upgrades a Message Queue for Apache Kafka instance that uses the subscription billing method.
 *
 * @description Before you call this operation, make sure that you understand the billing method and pricing of subscription Message Queue for Apache Kafka instances. For more information, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).
 *
 * @param tmpReq UpgradePrePayOrderRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpgradePrePayOrderResponse
 */
async function upgradePrePayOrderWithOptions(tmpReq: UpgradePrePayOrderRequest, runtime: Util.RuntimeOptions): UpgradePrePayOrderResponse {
  Util.validateModel(tmpReq);
  var request = new UpgradePrePayOrderShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.confluentConfig)) {
    request.confluentConfigShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.confluentConfig, 'ConfluentConfig', 'json');
  }
  var query = {};
  if (!Util.isUnset(request.confluentConfigShrink)) {
    query['ConfluentConfig'] = request.confluentConfigShrink;
  }
  if (!Util.isUnset(request.diskSize)) {
    query['DiskSize'] = request.diskSize;
  }
  if (!Util.isUnset(request.eipMax)) {
    query['EipMax'] = request.eipMax;
  }
  if (!Util.isUnset(request.eipModel)) {
    query['EipModel'] = request.eipModel;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ioMax)) {
    query['IoMax'] = request.ioMax;
  }
  if (!Util.isUnset(request.ioMaxSpec)) {
    query['IoMaxSpec'] = request.ioMaxSpec;
  }
  if (!Util.isUnset(request.paidType)) {
    query['PaidType'] = request.paidType;
  }
  if (!Util.isUnset(request.partitionNum)) {
    query['PartitionNum'] = request.partitionNum;
  }
  if (!Util.isUnset(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!Util.isUnset(request.specType)) {
    query['SpecType'] = request.specType;
  }
  if (!Util.isUnset(request.topicQuota)) {
    query['TopicQuota'] = request.topicQuota;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpgradePrePayOrder',
    version = '2019-09-16',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Upgrades a Message Queue for Apache Kafka instance that uses the subscription billing method.
 *
 * @description Before you call this operation, make sure that you understand the billing method and pricing of subscription Message Queue for Apache Kafka instances. For more information, see [Billing overview](https://help.aliyun.com/document_detail/84737.html).
 *
 * @param request UpgradePrePayOrderRequest
 * @return UpgradePrePayOrderResponse
 */
async function upgradePrePayOrder(request: UpgradePrePayOrderRequest): UpgradePrePayOrderResponse {
  var runtime = new Util.RuntimeOptions{};
  return upgradePrePayOrderWithOptions(request, runtime);
}

